We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9d9351 commit 5ac919bCopy full SHA for 5ac919b
django/template/defaultfilters.py
@@ -437,16 +437,13 @@ def pluralize(value, arg='s'):
437
is used instead. If the provided argument contains a comma, the text before
438
the comma is used for the singular case.
439
"""
440
+ if not ',' in arg:
441
+ arg = ',' + arg
442
bits = arg.split(',')
- if len(bits) == 2:
- singular_suffix = bits[0]
443
- plural_suffix = bits[1]
444
- elif len(bits) == 1:
445
- singular_suffix = ''
446
- plural_suffix = bits[0]
447
- else:
+ if len(bits) > 2:
448
return ''
449
-
+ singular_suffix, plural_suffix = bits[:2]
+
450
try:
451
if int(value) != 1:
452
return plural_suffix
0 commit comments