diff options
| author | Brian Rosner <brosner@gmail.com> | 2008-08-23 04:46:33 +0000 |
|---|---|---|
| committer | Brian Rosner <brosner@gmail.com> | 2008-08-23 04:46:33 +0000 |
| commit | a64dc39fb7c6787c83ea2e807c5bf2f94ad5909d (patch) | |
| tree | fe1d7999fcf8110702a8698f1a18aab46410ecc8 /django | |
| parent | 264771f1b60c048d70fc439535392092b0403f93 (diff) | |
Fixed #7602 -- Corrected lookup keyword arguments in archive_month and archive_week to properly range when date_field is from DateField. Thanks nullie for the original patch and Colin Grady for the test coverage.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8476 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django')
| -rw-r--r-- | django/views/generic/date_based.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/django/views/generic/date_based.py b/django/views/generic/date_based.py index a745559819..c5f1748a89 100644 --- a/django/views/generic/date_based.py +++ b/django/views/generic/date_based.py @@ -129,7 +129,10 @@ def archive_month(request, year, month, queryset, date_field, last_day = first_day.replace(year=first_day.year + 1, month=1) else: last_day = first_day.replace(month=first_day.month + 1) - lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)} + lookup_kwargs = { + '%s__gte' % date_field: first_day, + '%s__lt' % date_field: last_day, + } # Only bother to check current date if the month isn't in the past and future objects are requested. if last_day >= now.date() and not allow_future: @@ -188,7 +191,10 @@ def archive_week(request, year, week, queryset, date_field, # Calculate first and last day of week, for use in a date-range lookup. first_day = date last_day = date + datetime.timedelta(days=7) - lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)} + lookup_kwargs = { + '%s__gte' % date_field: first_day, + '%s__lt' % date_field: last_day, + } # Only bother to check current date if the week isn't in the past and future objects aren't requested. if last_day >= now.date() and not allow_future: |
