Ticket #6888: fix_1_lte_gt.diff

File fix_1_lte_gt.diff, 1.0 KB (added by scottb, 17 years ago)
  • django/views/generic/date_based.py

     
    123123    model = queryset.model
    124124    now = datetime.datetime.now()
    125125
    126     # Calculate first and last day of month, for use in a date-range lookup.
     126    # Calculate first day of target and next month.
    127127    first_day = date.replace(day=1)
    128128    if first_day.month == 12:
    129129        last_day = first_day.replace(year=first_day.year + 1, month=1)
    130130    else:
    131131        last_day = first_day.replace(month=first_day.month + 1)
    132     lookup_kwargs = {'%s__range' % date_field: (first_day, last_day)}
    133132
     133    lookup_kwargs = {'%s__gte' % date_field: first_day, '%s__lt' % date_field: last_day}
     134   
    134135    # Only bother to check current date if the month isn't in the past and future objects are requested.
    135136    if last_day >= now.date() and not allow_future:
    136137        lookup_kwargs['%s__lte' % date_field] = now
Back to Top