Changes between Version 10 and Version 11 of Ticket #29724, comment 9


Ignore:
Timestamp:
Sep 4, 2019, 5:43:55 PM (5 years ago)
Author:
yab

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #29724, comment 9

    v10 v11  
    99def link (filters):
    1010{{{
    11                 elif year_lookup and month_lookup:
    1211                        month_filter=field_name+'__month'
    1312                        year_filter=field_name+'__year'
    1413                        dates_or_datetimes = cl.model.objects.filter(**{year_filter:year_lookup, month_filter:month_lookup}).values_list(field_name, flat=True)
    15                         days = dates_or_datetimes
    16                         if isinstance(dates_or_datetimes[0], datetime.datetime) and settings.USE_TZ:
    17                                 days = []
     14                        days = []
     15                        if dates_or_datetimes.count()>0 and isinstance(dates_or_datetimes.first(), datetime.datetime) and settings.USE_TZ:
    1816                                for day in dates_or_datetimes:
    19                                         if make_naive(day).date() not in days: days.append(make_naive(day).date())
    20                        
     17                                        if make_naive(day).date() not in days:
     18                                                days.append(make_naive(day).date())
     19                        else:
     20                                for day in dates_or_datetimes:
     21                                        if day not in days: days.append(day)
    2122}}}
    2223
Back to Top