Opened 18 years ago
Closed 17 years ago
#3585 closed (wontfix)
django.views.generic.date_based.archive_{month,day}: date of first object outside interval available in template context
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Generic views | Version: | dev |
Severity: | Keywords: | ||
Cc: | poj+django@… | Triage Stage: | Design decision needed |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Ticket #2368 suggests that in django.views.generic.date_based
generic views, previous_month
and previous_day
should reflect if there is objects in those months.
When trying to port the patch attached to #2368 to the state after the changes introduced in fixing #2433 with changeset [3457], I realised it was not entirely sensible.
The patch attached to this Ticket implements new variables in template context for django.views.generic.date_based.archive_month
and django.views.generic.date_based.archive_day
, previous_object_date
and next_object_date
, which gives the possibility to access the date of the first accessible object outside the interval in either direction.
Attachments (2)
Change History (7)
by , 18 years ago
Attachment: | gv_datebased_object_date.diff added |
---|
by , 18 years ago
Attachment: | gv_datebased_object_date.2.diff added |
---|
comment:1 by , 18 years ago
follow-up: 3 comment:2 by , 18 years ago
Triage Stage: | Unreviewed → Design decision needed |
---|
It's not clear to me why this is needed; can you explain what's wrong with previous_month/day?
comment:3 by , 18 years ago
previous_month/day is currently just the date of the month/day before the one currently shown, and doesn't tell if there are any objects there.
On use-case is that you are using allow_empty=True
, and want to reference the month/day on either side of the currently displayed (to create links to empty pages, perhaps so that the user can bookmark them), but also want to link to the month/day with the closest accessible object outside the interval that is currently being shown.
It is possible that the information in previous_month/day should be changed to reflect the information my patch puts in previous_object_date, but that changes current behaviour.
comment:5 by , 17 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I'm wary of further complicating generic views (they're already pretty hairy). Since you can do this with a wrapper around the generic view that sets extra_context, I think that's a better approach.
Updated the patch as there were a bug in the original one.