class DateMixin
[source]
A mixin class providing common behavior for all date-based views.
Methods and Attributes
-
date_field
-
The name of the
DateField
orDateTimeField
in theQuerySet
’s model that the date-based archive should use to determine the list of objects to display on the page.When time zone support is enabled and
date_field
is aDateTimeField
, dates are assumed to be in the current time zone. Otherwise, the queryset could include objects from the previous or the next day in the end user’s time zone.Warning
In this situation, if you have implemented per-user time zone selection, the same URL may show a different set of objects, depending on the end user’s time zone. To avoid this, you should use a
DateField
as thedate_field
attribute.
-
allow_future
-
A boolean specifying whether to include “future” objects on this page, where “future” means objects in which the field specified in
date_field
is greater than the current date/time. By default, this isFalse
.
-
get_date_field()
[source] -
Returns the name of the field that contains the date data that this view will operate on. Returns
date_field
by default.
-
get_allow_future()
[source] -
Determine whether to include “future” objects on this page, where “future” means objects in which the field specified in
date_field
is greater than the current date/time. Returnsallow_future
by default.
Please login to continue.