Django

Code

Changeset 2323

Show
Ignore:
Timestamp:
02/17/06 12:03:54 (3 years ago)
Author:
adrian
Message:

Fixed #1302 -- Added next_month and previous_month to template context in archive_month date-based generic view. Thanks, ubernostrum

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/views/generic/date_based.py

    r1773 r2323  
    9696    Context: 
    9797        month: 
    98             this month 
     98            (date) this month 
     99        next_month: 
     100            (date) the first day of the next month, or None if the next month is in the future 
     101        previous_month: 
     102            (date) the first day of the previous month 
    99103        object_list: 
    100104            list of objects published in the given month 
     
    127131        'object_list': object_list, 
    128132        'month': date, 
     133        'next_month': (last_day < datetime.date.today()) and (last_day + datetime.timedelta(days=1)) or None, 
     134        'previous_month': first_day - datetime.timedelta(days=1), 
    129135    }, context_processors) 
    130136    for key, value in extra_context.items(): 
  • django/trunk/docs/generic_views.txt

    r2319 r2323  
    193193 
    194194        ``month`` 
    195             The given month (a datetime.datetime object) 
     195            The given month (a datetime.date object) 
     196        ``next_month`` 
     197            **New in Django development version.** The first day of the next 
     198            month, or None if the next month is in the future (a datetime.date 
     199            object) 
     200        ``previous_month`` 
     201            **New in Django development version.** The first day of the 
     202            previous month (a datetime.date object) 
    196203        ``object_list`` 
    197204            List of objects published in the given month