mirror of
				https://github.com/django/django.git
				synced 2025-10-28 16:16:12 +00:00 
			
		
		
		
	Fixed #992 -- Fixed bug in archive_month generic view leaving out the last day of the month. Thanks, ubernostrum
git-svn-id: http://code.djangoproject.com/svn/django/trunk@1571 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
		| @@ -108,14 +108,10 @@ def archive_month(request, year, month, app_label, module_name, date_field, | ||||
|     now = datetime.datetime.now() | ||||
|     # Calculate first and last day of month, for use in a date-range lookup. | ||||
|     first_day = date.replace(day=1) | ||||
|     last_day = date | ||||
|     for i in (31, 30, 29, 28): | ||||
|         try: | ||||
|             last_day = last_day.replace(day=i) | ||||
|         except ValueError: | ||||
|             continue | ||||
|     if first_day.month == 12: | ||||
|         last_day = first_day.replace(year=first_day.year + 1, month=1) | ||||
|     else: | ||||
|             break | ||||
|         last_day = first_day.replace(month=first_day.month + 1) | ||||
|     lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)} | ||||
|     # Only bother to check current date if the month isn't in the past. | ||||
|     if last_day >= now.date(): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user