summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2006-07-04 06:18:39 +0000
committerRussell Keith-Magee <russell@keith-magee.com>2006-07-04 06:18:39 +0000
commitb9d9351e852bae532620f174a13a1cd966886b04 (patch)
treea6ae9c112e899c545dd5da36ef96c2f430afdde1 /docs
parentec4a143a407169f6a7b6d79695db6a641b242f9b (diff)
Fixes #2202 -- Added ability to customize output of pluralize filter to handle irregular cases (walrus/walruses, cherry/cherries). Thanks to gid for the suggestion and the initial patch
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3272 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.txt16
1 files changed, 15 insertions, 1 deletions
diff --git a/docs/templates.txt b/docs/templates.txt
index 42947510d1..4ba52b3263 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -951,12 +951,26 @@ any string.
pluralize
~~~~~~~~~
-Returns ``'s'`` if the value is not 1.
+Returns a plural suffix if the value is not 1. By default, this suffix is ``'s'``.
Example::
You have {{ num_messages }} message{{ num_messages|pluralize }}.
+For words that require a suffix other than ``'s'``, you can provide an alternate
+suffix as a parameter to the filter.
+
+Example::
+
+ You have {{ num_walruses }} walrus{{ num_walrus|pluralize:"es" }}.
+
+For words that don't pluralize by simple suffix, you can specify both a
+singular and plural suffix, separated by a comma.
+
+Example::
+
+ You have {{ num_cherries }} cherr{{ num_cherries|pluralize:"y,ies" }}.
+
pprint
~~~~~~