Ticket #3189: date_based.py.diff
File date_based.py.diff, 1.1 KB (added by , 18 years ago) |
---|
-
date_based.py
161 161 return HttpResponse(t.render(c), mimetype=mimetype) 162 162 163 163 def archive_week(request, year, week, queryset, date_field, 164 template_name=None, template_loader=loader, 164 template_name=None, template_loader=loader, week_starts_monday=False, 165 165 extra_context=None, allow_empty=True, context_processors=None, 166 166 template_object_name='object', mimetype=None, allow_future=False): 167 167 """ … … 184 184 now = datetime.datetime.now() 185 185 186 186 # Calculate first and last day of week, for use in a date-range lookup. 187 first_day = date 188 last_day = date + datetime.timedelta(days=7) 187 if week_starts_monday: 188 date = date + datetime.timedelta(days=1) 189 first_day = date 190 last_day = date + datetime.timedelta(days=7) 189 191 lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)} 190 192 191 193 # Only bother to check current date if the week isn't in the past and future objects aren't requested.