module documentation

Undocumented

Class ​Base​Archive​Index​View Base class for archives of date-based items. Requires a response mixin.
Class ​Base​Date​Detail​View 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 ​Base​Date​List​View Abstract base class for date-based views displaying a list of objects.
Class ​Base​Day​Archive​View List of objects published on a given day.
Class ​Base​Month​Archive​View List of objects published in a given month.
Class ​Base​Today​Archive​View List of objects published today.
Class ​Base​Week​Archive​View List of objects published in a given week.
Class ​Base​Year​Archive​View List of objects published in a given year.
Class ​Date​Mixin Mixin class for views manipulating date-based data.
Class ​Day​Mixin Mixin for views manipulating day-based data.
Class ​Month​Mixin Mixin for views manipulating month-based data.
Class ​Week​Mixin Mixin for views manipulating week-based data.
Class ​Year​Mixin 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.
def _date_from_string(year, year_format, month='', month_format='', day='', day_format='', delim='__'):
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.
def _get_next_prev(generic_view, date, is_previous, period):

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.
def timezone_today():
Return the current date in the current time zone.