Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#13607 closed (fixed)

Admin date_hierarchy drill-down should auto-initialise to appropriate level

Reported by: DrMeers Owned by: DrMeers
Component: User Experience Version: master
Severity: Keywords: admin, date_hierarchy, sprintdec2010
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Say you have a model with a date_hierarchy field selected in the ModelAdmin, but the dates so far only span a few days. Instead of seeing the year displayed, then clicking it to show the month, then clicking it to show the days, perhaps it would be a good idea to initialise it based on the span of dates to show the first level with multiple options. That is, if all the dates are in one month, show the day-level drill-down initially. If two months are spanned, but in the same year, show the month-level drill down initially. If multiple years are indeed spanned, then start with the year-level interface.

Similarly to how list_filters intelligently show/hide themselves based on available data.

Happy to code this, just wanted to get my thoughts down first.

Attachments (5)

date_hierarchy_initialisation.diff (959 bytes) - added by DrMeers 5 years ago.
date_hierarchy_initialisation.2.diff (958 bytes) - added by DrMeers 5 years ago.
Oops, can't use "any" yet…
date_hierarchy_initialisation.3.diff (1.1 KB) - added by DrMeers 5 years ago.
Include check in case of empty querysets
13607.diff (6.4 KB) - added by DrMeers 4 years ago.
13607.2.diff (6.6 KB) - added by DrMeers 4 years ago.
Whitespace fixes :)

Download all attachments as: .zip

Change History (12)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Sounds like a reasonable suggestion; implementing it in an efficient way could be interesting, though.

Changed 5 years ago by DrMeers

comment:2 Changed 5 years ago by DrMeers

  • Has patch set
  • Owner set to DrMeers
  • Status changed from new to assigned

Pretty dead-simple patch really. Much nicer to use now. I don't think the aggregate query has any major efficiency issues?

Changed 5 years ago by DrMeers

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

Changed 5 years ago by DrMeers

Include check in case of empty querysets

comment:3 Changed 5 years ago by mk

  • Needs tests set
  • Patch needs improvement set

A (dumb?) question: Is cl.query_set the unfiltered queryset or is it already filtered down by list_filters?

Plus, tests are missing.

Changed 4 years ago by DrMeers

comment:4 Changed 4 years ago by DrMeers

  • Keywords sprintdec2010 added
  • Needs tests unset
  • Patch needs improvement unset

Changed 4 years ago by DrMeers

Whitespace fixes :)

comment:5 Changed 4 years ago by brodie

  • Triage Stage changed from Accepted to Ready for checkin

comment:6 Changed 4 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [14879]) Fixed #13607 -- Auto-initialize admin's date hierarchy links intelligently. Thanks, Simon Meers.

comment:7 Changed 4 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

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