Ticket #10458: patch.diff

File patch.diff, 1.6 KB (added by fperetti, 16 years ago)

Add patch and test

  • tests/regressiontests/views/tests/generic/date_based.py

     
    11# coding: utf-8
    22from django.test import TestCase
    3 from datetime import datetime
     3from datetime import datetime, date
    44from datetime import timedelta
    55from regressiontests.views.models import Article, Author, DateArticle
    66
     
    7272
    7373        article2.date_created = first_second_of_feb.date()
    7474        article2.save()
     75       
     76        # regression test for #10458
    7577        response = self.client.get('/views/date_based/datefield/archive_month/2004/02/')
    7678        self.assertEqual(response.status_code, 200)
     79        self.assertEqual(response.context['next_month'], date(2004, 3, 1))
    7780
    7881        article2.date_created = (first_second_of_feb-two_seconds).date()
    7982        article2.save()
  • django/views/generic/date_based.py

     
    133133        '%s__gte' % date_field: first_day,
    134134        '%s__lt' % date_field: last_day,
    135135    }
    136 
     136    last_day = last_day - datetime.timedelta(days=1)
    137137    # Only bother to check current date if the month isn't in the past and future objects are requested.
    138138    if last_day >= now.date() and not allow_future:
    139139        lookup_kwargs['%s__lte' % date_field] = now
Back to Top