Ticket #10458: patch.diff
File patch.diff, 1.6 KB (added by , 16 years ago) |
---|
-
tests/regressiontests/views/tests/generic/date_based.py
1 1 # coding: utf-8 2 2 from django.test import TestCase 3 from datetime import datetime 3 from datetime import datetime, date 4 4 from datetime import timedelta 5 5 from regressiontests.views.models import Article, Author, DateArticle 6 6 … … 72 72 73 73 article2.date_created = first_second_of_feb.date() 74 74 article2.save() 75 76 # regression test for #10458 75 77 response = self.client.get('/views/date_based/datefield/archive_month/2004/02/') 76 78 self.assertEqual(response.status_code, 200) 79 self.assertEqual(response.context['next_month'], date(2004, 3, 1)) 77 80 78 81 article2.date_created = (first_second_of_feb-two_seconds).date() 79 82 article2.save() -
django/views/generic/date_based.py
133 133 '%s__gte' % date_field: first_day, 134 134 '%s__lt' % date_field: last_day, 135 135 } 136 136 last_day = last_day - datetime.timedelta(days=1) 137 137 # Only bother to check current date if the month isn't in the past and future objects are requested. 138 138 if last_day >= now.date() and not allow_future: 139 139 lookup_kwargs['%s__lte' % date_field] = now