Django

Code

Changeset 4647

Show
Ignore:
Timestamp:
02/28/07 10:18:55 (2 years ago)
Author:
jacob
Message:

Fixed #3488: Added "b" option to date format filter. Thanks, Gary Wilson.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/utils/dateformat.py

    r4226 r4647  
    1717import re, time 
    1818 
    19 re_formatchars = re.compile(r'(?<!\\)([aABdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])') 
     19re_formatchars = re.compile(r'(?<!\\)([aAbBdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])') 
    2020re_escaped = re.compile(r'\\(.)') 
    2121 
     
    110110        if hasattr(self.data, 'hour') and not self.timezone: 
    111111            self.timezone = LocalTimezone(dt) 
     112 
     113    def b(self): 
     114        "Month, textual, 3 letters, lowercase; e.g. 'jan'" 
     115        return MONTHS_3[self.data.month] 
    112116 
    113117    def d(self): 
  • django/trunk/docs/templates.txt

    r4499 r4647  
    646646                      to match Associated Press style.) 
    647647    A                 ``'AM'`` or ``'PM'``.                     ``'AM'`` 
     648    b                 Month, textual, 3 letters, lowercase.     ``'jan'`` 
    648649    B                 Not implemented. 
    649650    d                 Day of the month, 2 digits with           ``'01'`` to ``'31'`` 
  • django/trunk/tests/regressiontests/dateformat/tests.py

    r3862 r4647  
    1818>>> format(my_birthday, 'M') 
    1919'Jul' 
     20>>> format(my_birthday, 'b') 
     21'jul' 
    2022>>> format(my_birthday, 'n') 
    2123'7'