#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_filter
s intelligently show/hide themselves based on available data.
Happy to code this, just wanted to get my thoughts down first.
Attachments (5)
Change History (12)
comment:1 by , 14 years ago
Triage Stage: | Unreviewed → Accepted |
---|
by , 14 years ago
Attachment: | date_hierarchy_initialisation.diff added |
---|
comment:2 by , 14 years ago
Has patch: | set |
---|---|
Owner: | set to |
Status: | new → assigned |
Pretty dead-simple patch really. Much nicer to use now. I don't think the aggregate query has any major efficiency issues?
by , 14 years ago
Attachment: | date_hierarchy_initialisation.2.diff added |
---|
Oops, can't use "any" yet...
by , 14 years ago
Attachment: | date_hierarchy_initialisation.3.diff added |
---|
Include check in case of empty querysets
comment:3 by , 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 , 14 years ago
Attachment: | 13607.diff added |
---|
comment:4 by , 14 years ago
Keywords: | sprintdec2010 added |
---|---|
Needs tests: | unset |
Patch needs improvement: | unset |
comment:5 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
comment:6 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Sounds like a reasonable suggestion; implementing it in an efficient way could be interesting, though.