Opened 11 years ago

Closed 11 years ago

#7161 closed (wontfix)

Date-based views provide inappropriate dates for next_/previous_ day/month

Reported by: Ionut Ciocirlan <ionut.ciocirlan@…> Owned by: nobody
Component: Generic views Version: master
Severity: Keywords: date-based next previous
Cc: Triage Stage: Design decision needed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


The archive_month's and archive_day's next_* / previous_* are not appropriate, given the views are aware of the queryset. The simplistic +-1 day/month calculations should debatably go into a filter. But the real issue is that with allow_empty=False (which is the default), the current implementation will easily lead to 404 pages, rendering them rather useless. Not everybody publishes items every day, or every month for that matter.

The attached patch turns next_day / previous_day / next_month / previous_month into callables, so they will get lazily executed when used in the template. It depends on the patch in ticket #7153 to work.

Attachments (1)

date_based.next_prev.diff (6.6 KB) - added by Ionut Ciocirlan <ionut.ciocirlan@…> 11 years ago.

Download all attachments as: .zip

Change History (3)

Changed 11 years ago by Ionut Ciocirlan <ionut.ciocirlan@…>

Attachment: date_based.next_prev.diff added

comment:1 Changed 11 years ago by Jeff Anderson

Triage Stage: UnreviewedDesign decision needed

comment:2 Changed 11 years ago by Ramiro Morales

Resolution: wontfix
Status: newclosed

#3585 proposed something similar but maintaining backward compatibility (by providing new context vars with the values of next/prev month/day containing a object of the queryset) and was closed wontfix. This ticket proposes changing the semantics of the currently available context vars and so would be backwards incompatible.

Thus, I'm also closing it as wontfix.

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