id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 10688 archive_month generic view next_month is incorrect anonymous nobody "This isn't an april fools day joke, I promise. However, I did notice this due to me testing my site exactly when the month changed. django.generic.views.date_based.archive_month isn't consistent with ""last_day"", which makes next_month incorrect. last_day is calculated by first_day.replace(month=first_day.month + 1). This makes last_day be the *first* day of the next month, not the last day. I think that this is necessary because if the queryset is using DateTimeField instead of DateField, it won't compare as less than the last day of the month, but will compare as less than the first day of the second month. I haven't tested that theory, though. Anyway, next_month is then computed as last_day + timedelta(1), which is the *second* day of the month, not the first. More importantly, if it is the first of the month (as it is today), the test ""last_day < datetime.date.today()"" fails, causing next_month to be None when it should be valid. The fix is quite simple: set next_month to last_day instead of last_day + timedelta(1) and change the above test to test less-than-equal instead of just less-than. Patch provided. I would also suggest refactoring last_day to something more descriptive, though." closed Generic views 1.0 duplicate Unreviewed 1 0 0 0 0 0