Ticket #6449: django-datetime-filter.patch

File django-datetime-filter.patch, 934 bytes (added by Harm Geerts, 17 years ago)
  • django/template/defaultfilters.py

     
    620620    return format(value, arg)
    621621date.is_safe = False
    622622
     623def datetime(value, arg=None):
     624    """Formats a datetime according to the given format."""
     625    from django.utils.dateformat import format
     626    if not value:
     627        return u''
     628    if arg is None:
     629        arg = settings.DATETIME_FORMAT
     630    return format(value, arg)
     631datetime.is_safe = False
     632
    623633def time(value, arg=None):
    624634    """Formats a time according to the given format."""
    625635    from django.utils.dateformat import time_format
     
    793803register.filter(center)
    794804register.filter(cut)
    795805register.filter(date)
     806register.filter(datetime)
    796807register.filter(default)
    797808register.filter(default_if_none)
    798809register.filter(dictsort)
Back to Top