Opened 10 years ago

Closed 9 years ago

#1381 closed defect (worksforme)

'django.views.generic.date_based.archive_index' doesn't return latest objects first

Reported by: jakamkon@… Owned by: jacob
Component: Generic views Version: master
Severity: trivial Keywords: django.views.generic.date_based.archive_index archive_index
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


In django/views/generic/ we have:

def archive_index:
  lookup_kwargs = {'%s__lte' % date_field:} # *
  date_list = getattr(mod, "get_%s_list" % date_field)('year', **lookup_kwargs)[::-1]

Consider situation:

[datetime.datetime(2005, 1, 1, 0, 0), datetime.datetime(2006, 1, 1, 0, 0)]

some_model.get_date_list('year', # situation as in *
[datetime.datetime(2005, 1, 1, 0, 0)] # we get the oldest year

In other words we get the oldest objects in place of the latest in our view.

When * is changed to:

 lookup_kwargs = {'%s__gte' % date_field:}

Now, we get the latest date:

[datetime.datetime(2006, 1, 1, 0, 0)]


Change History (2)

comment:1 Changed 9 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Design decision needed

comment:2 Changed 9 years ago by mtredinnick

  • Resolution set to worksforme
  • Status changed from new to closed

This has been fixed in the interim at some point.

Note: See TracTickets for help on using tickets.
Back to Top