Author: ubernostrum
Date: 2007-10-10 10:51:38 -0500 (Wed, 10 Oct 2007)
New Revision: 6471
Modified:
django/branches/0.91-bugfixes/django/core/template/defaultfilters.py
Log:
0.91-bugfixes: Minor improvement to [6468
Modified: django/branches/0.91-bugfixes/django/core/template/defaultfilters.py
===================================================================
--- django/branches/0.91-bugfixes/django/core/template/defaultfilters.py
2007-10-10 02:48:26 UTC (rev 6470)
+++ django/branches/0.91-bugfixes/django/core/template/defaultfilters.py
2007-10-10 15:51:38 UTC (rev 6471)
@@ -327,23 +327,25 @@
# DATES #
###################
+EMPTY_DATE_VALUES = (None, '')
+
def date(value, arg=DATE_FORMAT):
"Formats a date according to the given format"
- if not value:
+ if value in EMPTY_DATE_VALUES:
return ''
from django.utils.dateformat import format
return format(value, arg)
def time(value, arg=TIME_FORMAT):
"Formats a time according to the given format"
- if not value:
+ if value in EMPTY_DATE_VALUES:
return ''
from django.utils.dateformat import time_format
return time_format(value, arg)
def timesince(value):
'Formats a date as the time since that date (i.e. "4 days, 6 hours")'
- if not value:
+ if value in EMPTY_DATE_VALUES:
return ''
from django.utils.timesince import timesince
return timesince(value)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---