summaryrefslogtreecommitdiff
path: root/django/views
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-02-17 18:03:54 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-02-17 18:03:54 +0000
commit6b694097dc22569f1b86feec20a1ff30a2b14b26 (patch)
treee72ef8e70af11507e493885b831ce0fd4c3728d7 /django/views
parentb3f99ec9fefaaac1d9bbd7c99d09226623cb57e5 (diff)
downloaddjango-6b694097dc22569f1b86feec20a1ff30a2b14b26.tar.gz
Fixed #1302 -- Added next_month and previous_month to template context in archive_month date-based generic view. Thanks, ubernostrum
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2323 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/views')
-rw-r--r--django/views/generic/date_based.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/django/views/generic/date_based.py b/django/views/generic/date_based.py
index 1b9e8e9587..a4746f0574 100644
--- a/django/views/generic/date_based.py
+++ b/django/views/generic/date_based.py
@@ -95,7 +95,11 @@ def archive_month(request, year, month, app_label, module_name, date_field,
Templates: ``<app_label>/<module_name>_archive_month``
Context:
month:
- this month
+ (date) this month
+ next_month:
+ (date) the first day of the next month, or None if the next month is in the future
+ previous_month:
+ (date) the first day of the previous month
object_list:
list of objects published in the given month
"""
@@ -126,6 +130,8 @@ def archive_month(request, year, month, app_label, module_name, date_field,
c = DjangoContext(request, {
'object_list': object_list,
'month': date,
+ 'next_month': (last_day < datetime.date.today()) and (last_day + datetime.timedelta(days=1)) or None,
+ 'previous_month': first_day - datetime.timedelta(days=1),
}, context_processors)
for key, value in extra_context.items():
if callable(value):