Ticket #3189: date_based.py.diff

File date_based.py.diff, 1.1 KB (added by nicolaslara@…, 18 years ago)

date_based.py.diff

  • date_based.py

     
    161161    return HttpResponse(t.render(c), mimetype=mimetype)
    162162
    163163def 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,
    165165        extra_context=None, allow_empty=True, context_processors=None,
    166166        template_object_name='object', mimetype=None, allow_future=False):
    167167    """
     
    184184    now = datetime.datetime.now()
    185185
    186186    # 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)
    189191    lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)}
    190192
    191193    # Only bother to check current date if the week isn't in the past and future objects aren't requested.
Back to Top