Ticket #2127: filter.diff

File filter.diff, 1.0 KB (added by Gary Wilson <gary.wilson@…>, 18 years ago)
  • template/defaultfilters.py

     
    329329
    330330def date(value, arg=None):
    331331    "Formats a date according to the given format"
     332    # Fail silently if value is None.
     333    if not value:
     334        return ''
    332335    from django.utils.dateformat import format
    333336    if arg is None:
    334337        arg = settings.DATE_FORMAT
     
    336339
    337340def time(value, arg=None):
    338341    "Formats a time according to the given format"
     342    # Fail silently if value is None.
     343    if not value:
     344        return ''
    339345    from django.utils.dateformat import time_format
    340346    if arg is None:
    341347        arg = settings.TIME_FORMAT
     
    343349
    344350def timesince(value):
    345351    'Formats a date as the time since that date (i.e. "4 days, 6 hours")'
     352    # Fail silently if value is None.
     353    if not value:
     354        return ''
    346355    from django.utils.timesince import timesince
    347356    return timesince(value)
    348357
Back to Top