Ticket #12771: patch_with_docs.diff

File patch_with_docs.diff, 5.3 KB (added by xtrqt, 15 years ago)

Added documentation.

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

    diff --git a/django/contrib/humanize/templatetags/humanize.py b/django/contrib/humanize/templatetags/humanize.py
    index cfa93fe..6a3ecd5 100644
    a b from django.utils.translation import ungettext, ugettext as _  
    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()
    def naturalday(value, arg=None):  
    100100        return _(u'yesterday')
    101101    return defaultfilters.date(value, arg)
    102102register.filter(naturalday)
     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
     132
     133
     134
  • docs/ref/contrib/humanize.txt

    diff --git a/docs/ref/contrib/humanize.txt b/docs/ref/contrib/humanize.txt
    index ef48f48..a9a2c17 100644
    a b Examples (when 'today' is 17 Feb 2007):  
    8282    * Any other day is formatted according to given argument or the
    8383      :setting:`DATE_FORMAT` setting if no argument is given.
    8484
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
     101
     102
     103
     104
     105
     106
     107
    85108.. templatefilter:: ordinal
    86109
    87110ordinal
  • tests/regressiontests/humanize/tests.py

    diff --git a/tests/regressiontests/humanize/tests.py b/tests/regressiontests/humanize/tests.py
    index 7eeaaee..c53060b 100644
    a b  
    1 from datetime import timedelta, date
     1from datetime import timedelta, date
    22
    33from django.template import Template, Context, add_to_builtins
    44from django.utils import unittest
    class HumanizeTests(unittest.TestCase):  
    6060
    6161    def test_naturalday(self):
    6262        from django.template import defaultfilters
    63         today = date.today()
     63        today = date()
    6464        yesterday = today - timedelta(days=1)
    6565        tomorrow = today + timedelta(days=1)
    6666        someday = today - timedelta(days=10)
    class HumanizeTests(unittest.TestCase):  
    7272                       someday_result, u"I'm not a date value", None)
    7373        self.humanize_tester(test_list, result_list, 'naturalday')
    7474
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
     100
    75101if __name__ == '__main__':
    76102    unittest.main()
    77103
Back to Top