Opened 14 years ago

Closed 14 years ago

Last modified 13 years ago

#13607 closed (fixed)

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

Reported by: Simon Meers Owned by: Simon Meers
Component: User Experience Version: dev
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: no UI/UX: no

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 Simon Meers 14 years ago.
date_hierarchy_initialisation.2.diff (958 bytes ) - added by Simon Meers 14 years ago.
Oops, can't use "any" yet…
date_hierarchy_initialisation.3.diff (1.1 KB ) - added by Simon Meers 14 years ago.
Include check in case of empty querysets
13607.diff (6.4 KB ) - added by Simon Meers 14 years ago.
13607.2.diff (6.6 KB ) - added by Simon Meers 14 years ago.
Whitespace fixes :)

Download all attachments as: .zip

Change History (12)

comment:1 by Russell Keith-Magee, 14 years ago

Triage Stage: UnreviewedAccepted

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

by Simon Meers, 14 years ago

comment:2 by Simon Meers, 14 years ago

Has patch: set
Owner: set to Simon Meers
Status: newassigned

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

by Simon Meers, 14 years ago

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

by Simon Meers, 14 years ago

Include check in case of empty querysets

comment:3 by Matthias Kestenholz, 14 years ago

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.

by Simon Meers, 14 years ago

Attachment: 13607.diff added

comment:4 by Simon Meers, 14 years ago

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

by Simon Meers, 14 years ago

Attachment: 13607.2.diff added

Whitespace fixes :)

comment:5 by Brodie Rao, 14 years ago

Triage Stage: AcceptedReady for checkin

comment:6 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: assignedclosed

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

comment:7 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

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