From c52ae07453a5556ba255aa115f2a4e8f56c7fd73 Mon Sep 17 00:00:00 2001 From: Marc Garcia Date: Mon, 13 Jul 2009 15:19:05 +0000 Subject: [soc2009/i18n] Date filter allowed to use predefined formats, improved fallbacks on getting formats, and documentation added. git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/i18n-improvements@11231 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- docs/ref/templates/builtins.txt | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'docs/ref') diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 32b5984767..ba45a6f1c4 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -870,7 +870,11 @@ If ``value`` is ``"String with spaces"``, the output will be ``"Stringwithspaces date ~~~~ -Formats a date according to the given format (same as the `now`_ tag). +Formats a date according to the given format. + +Given format can be one of the predefined ones ``DATE_FORMAT``, ``DATETIME_FORMAT``, +``SHORT_DATE_FORMAT`` or ``SHORT_DATETIME_FORMAT``, or a custom format, same as the +`now`_ tag. Note that prefedined formats vary depending on the current locale. For example:: @@ -885,7 +889,7 @@ When used without a format string:: {{ value|date }} ...the formatting string defined in the :setting:`DATE_FORMAT` setting will be -used. +used, without applying any localization. .. templatefilter:: default @@ -1433,7 +1437,10 @@ output will be ``"Joel is a slug"``. time ~~~~ -Formats a time according to the given format (same as the `now`_ tag). +Formats a time according to the given format. + +Given format can be the predefined one ``TIME_FORMAT``, or a custom format, same as the `now`_ tag. Note that the predefined format is locale depending. + The time filter will only accept parameters in the format string that relate to the time of day, not the date (for obvious reasons). If you need to format a date, use the `date`_ filter. @@ -1450,7 +1457,7 @@ When used without a format string:: {{ value|time }} ...the formatting string defined in the :setting:`TIME_FORMAT` setting will be -used. +used, without aplying any localization. .. templatefilter:: timesince -- cgit v1.3