Undocumented
Class | BaseArchiveIndexView |
Base class for archives of date-based items. Requires a response mixin. |
Class | BaseDateDetailView |
Detail view of a single object on a single date; this differs from the standard DetailView by accepting a year/month/day in the URL. |
Class | BaseDateListView |
Abstract base class for date-based views displaying a list of objects. |
Class | BaseDayArchiveView |
List of objects published on a given day. |
Class | BaseMonthArchiveView |
List of objects published in a given month. |
Class | BaseTodayArchiveView |
List of objects published today. |
Class | BaseWeekArchiveView |
List of objects published in a given week. |
Class | BaseYearArchiveView |
List of objects published in a given year. |
Class | DateMixin |
Mixin class for views manipulating date-based data. |
Class | DayMixin |
Mixin for views manipulating day-based data. |
Class | MonthMixin |
Mixin for views manipulating month-based data. |
Class | WeekMixin |
Mixin for views manipulating week-based data. |
Class | YearMixin |
Mixin for views manipulating year-based data. |
Function | _date_from_string |
Get a datetime.date object given a format string and a year, month, and day (only year is mandatory). Raise a 404 for an invalid date. |
Function | _get_next_prev |
Get the next or the previous valid date. The idea is to allow links on month/day views to never be 404s by never providing a date that'll be invalid for the given view. |
Function | timezone_today |
Return the current date in the current time zone. |
Get the next or the previous valid date. The idea is to allow links on month/day views to never be 404s by never providing a date that'll be invalid for the given view.
This is a bit complicated since it handles different intervals of time, hence the coupling to generic_view.
However in essence the logic comes down to:
- If allow_empty and allow_future are both true, this is easy: just return the naive result (just the next/previous day/week/month, regardless of object existence.)
- If allow_empty is true, allow_future is false, and the naive result isn't in the future, then return it; otherwise return None.
- If allow_empty is false and allow_future is true, return the next date that contains a valid object, even if it's in the future. If there are no next objects, return None.
- If allow_empty is false and allow_future is false, return the next date that contains a valid object. If that date is in the future, or if there are no next objects, return None.