Ticket #6888: fix_1_lte_gt.diff
File fix_1_lte_gt.diff, 1.0 KB (added by , 17 years ago) |
---|
-
django/views/generic/date_based.py
123 123 model = queryset.model 124 124 now = datetime.datetime.now() 125 125 126 # Calculate first and last day of month, for use in a date-range lookup.126 # Calculate first day of target and next month. 127 127 first_day = date.replace(day=1) 128 128 if first_day.month == 12: 129 129 last_day = first_day.replace(year=first_day.year + 1, month=1) 130 130 else: 131 131 last_day = first_day.replace(month=first_day.month + 1) 132 lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)}133 132 133 lookup_kwargs = {'%s__gte' % date_field: first_day, '%s__lt' % date_field: last_day} 134 134 135 # Only bother to check current date if the month isn't in the past and future objects are requested. 135 136 if last_day >= now.date() and not allow_future: 136 137 lookup_kwargs['%s__lte' % date_field] = now