Ticket #1302: date_based.diff

File date_based.diff, 967 bytes (added by James Bennett, 19 years ago)

patch to provide next_month and previous_month in archive_month generic view

  • date_based.py

     
    9595    Templates: ``<app_label>/<module_name>_archive_month``
    9696    Context:
    9797        month:
    98             this month
     98            (date) this month
     99        next_month:
     100            (date) the next day, or None if the next month would be a future date
     101        last_month:
     102            (date) the next month
    99103        object_list:
    100104            list of objects published in the given month
    101105    """
     
    126130    c = DjangoContext(request, {
    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():
    131137        if callable(value):
Back to Top