Ticket #12771: humanize+naturaltime.diff
| File humanize+naturaltime.diff, 2.1 KB (added by , 16 years ago) |
|---|
-
django/contrib/humanize/templatetags/humanize.py
2 2 from django.utils.encoding import force_unicode 3 3 from django import template 4 4 from django.template import defaultfilters 5 from datetime import date 5 from datetime import date 6 6 import re 7 7 8 8 register = template.Library() … … 14 14 """ 15 15 try: 16 16 value = int(value) 17 except (TypeError, ValueError):17 except : 18 18 return value 19 19 t = (_('th'), _('st'), _('nd'), _('rd'), _('th'), _('th'), _('th'), _('th'), _('th'), _('th')) 20 20 if value % 100 in (11, 12, 13): # special case … … 97 97 return _(u'yesterday') 98 98 return defaultfilters.date(value, arg) 99 99 register.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