Ticket #12771: humanize+naturaltime.diff

File humanize+naturaltime.diff, 2.1 KB (added by phinpho, 16 years ago)

patch for templatetag naturaltime

  • django/contrib/humanize/templatetags/humanize.py

     
    22from django.utils.encoding import force_unicode
    33from django import template
    44from django.template import defaultfilters
    5 from datetime import date
     5from datetime import date
    66import re
    77
    88register = template.Library()
     
    1414    """
    1515    try:
    1616        value = int(value)
    17     except (TypeError, ValueError):
     17    except :
    1818        return value
    1919    t = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th'), _('th'))
    2020    if value % 100 in (11, 12, 13): # special case
     
    9797        return _(u'yesterday')
    9898    return defaultfilters.date(value, arg)
    9999register.filter(naturalday)
     100
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
     111
     112
     113
     114
     115
     116
     117
     118
     119
     120
     121
     122
     123
     124
     125
     126
     127
     128
     129
     130
     131
Back to Top