Ticket #13607: date_hierarchy_initialisation.2.diff

File date_hierarchy_initialisation.2.diff, 958 bytes (added by DrMeers, 5 years ago)

Oops, can't use "any" yet...

  • templatetags/admin_list.py

     
    225225
    226226        link = lambda d: cl.get_query_string(d, [field_generic])
    227227
     228        if not (year_lookup or month_lookup or day_lookup):
     229            # select appropriate start level
     230            date_range = cl.query_set.aggregate(
     231                first=models.Min(field_name), last=models.Max(field_name))
     232            if date_range['first'].year == date_range['last'].year:
     233                year_lookup = date_range['first'].year
     234                if date_range['first'].month == date_range['last'].month:
     235                    month_lookup = date_range['first'].month
     236       
    228237        if year_lookup and month_lookup and day_lookup:
    229238            day = datetime.date(int(year_lookup), int(month_lookup), int(day_lookup))
    230239            return {
Back to Top