summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/template/defaultfilters.py4
-rw-r--r--tests/othertests/defaultfilters.py3
2 files changed, 5 insertions, 2 deletions
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py
index c75f371ec8..a2e9d2f405 100644
--- a/django/template/defaultfilters.py
+++ b/django/template/defaultfilters.py
@@ -339,7 +339,7 @@ def date(value, arg=None):
def time(value, arg=None):
"Formats a time according to the given format"
from django.utils.dateformat import time_format
- if not value:
+ if value in (None, ''):
return ''
if arg is None:
arg = settings.TIME_FORMAT
@@ -437,7 +437,7 @@ def pluralize(value, arg='s'):
is used instead. If the provided argument contains a comma, the text before
the comma is used for the singular case.
"""
- if not ',' in arg:
+ if not ',' in arg:
arg = ',' + arg
bits = arg.split(',')
if len(bits) > 2:
diff --git a/tests/othertests/defaultfilters.py b/tests/othertests/defaultfilters.py
index 1636b948d0..9b1cfda833 100644
--- a/tests/othertests/defaultfilters.py
+++ b/tests/othertests/defaultfilters.py
@@ -231,6 +231,9 @@ False
>>> time(datetime.time(13), "h")
'01'
+>>> time(datetime.time(0), "h")
+'12'
+
# real testing is done in timesince.py, where we can provide our own 'now'
>>> timesince(datetime.datetime.now() - datetime.timedelta(1))
'1 day'