diff options
| author | Jannis Leidel <jannis@leidel.info> | 2011-04-22 12:02:47 +0000 |
|---|---|---|
| committer | Jannis Leidel <jannis@leidel.info> | 2011-04-22 12:02:47 +0000 |
| commit | ea248f0107eb3bed5a4a0fb65d6065e5691bea0a (patch) | |
| tree | 2dc84a3a295d575427806b2cddcdbbf8c5290e83 /docs | |
| parent | 8b588747ed302fcdef0b79171ed3cf129cd32a38 (diff) | |
Fixed #12771 -- Added naturaltime filter to humanize contrib app. Thanks, phinpho, djansoft and xtrqt.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@16071 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/contrib/humanize.txt | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/docs/ref/contrib/humanize.txt b/docs/ref/contrib/humanize.txt index ef48f48fcc..f7afb9c5e8 100644 --- a/docs/ref/contrib/humanize.txt +++ b/docs/ref/contrib/humanize.txt @@ -82,6 +82,31 @@ Examples (when 'today' is 17 Feb 2007): * Any other day is formatted according to given argument or the :setting:`DATE_FORMAT` setting if no argument is given. +.. templatefilter:: naturaltime + +naturaltime +----------- + +.. versionadded:: 1.4 + +For date and time values shows how many seconds, minutes or hours ago compared +to current timestamp returns representing string. Otherwise, it behaves like +:tfilter:`naturaldate`, so it can also take string argument for date formating. + +**Argument:** Date formatting string as described in the :tfilter:`date` tag. + +Examples (when 'now' is 17 Feb 2007 16:30:00): + + * ``17 Feb 2007 16:30:00`` becomes ``now``. + * ``17 Feb 2007 16:29:31`` becomes ``29 seconds ago``. + * ``17 Feb 2007 16:29:00`` becomes ``a minute ago``. + * ``17 Feb 2007 16:25:35`` becomes ``4 minutes ago``. + * ``17 Feb 2007 15:30:29`` becomes ``an hours ago``. + * ``17 Feb 2007 13:31:29`` becomes ``2 hours ago``. + * ``16 Feb 2007 13:31:29`` becomes ``yesterday``. + * Any other day is formatted according to given argument or the + :setting:`DATE_FORMAT` setting if no argument is given. + .. templatefilter:: ordinal ordinal |
