class DayMixin

from django.views.generic.dates import DayMixin
Hierarchy diagram Documentation Source code
Mixin for views manipulating day-based data.

Attributes

  Defined in
day = None DayMixin
day_format = '%d' DayMixin
Expand Collapse

Methods

def _get_current_day(self, date): DayMixin

Return the start date of the current interval.
180
181
182
183
184
def _get_current_day(self, date):
    """
    Return the start date of the current interval.
    """
    return date

def _get_next_day(self, date): DayMixin

Return the start date of the next interval.

The interval is defined by start date <= item date < next start date.
172
173
174
175
176
177
def _get_next_day(self, date):
    """
    Return the start date of the next interval.
    The interval is defined by start date <= item date < next start date.
    """
    return date + datetime.timedelta(days=1)

def get_day(self): DayMixin

Return the day for which this view should display data.
145
146
147
148
149
150
151
152
153
154
155
156
157
158
def get_day(self):
    """
    Return the day for which this view should display data.
    """
    day = self.day
    if day is None:
        try:
            day = self.kwargs['day']
        except KeyError:
            try:
                day = self.request.GET['day']
            except KeyError:
                raise Http404(_("No day specified"))
    return day

def get_day_format(self): DayMixin

Get a day format string in strptime syntax to be used to parse the day
from url variables.
138
139
140
141
142
143
def get_day_format(self):
    """
    Get a day format string in strptime syntax to be used to parse the day
    from url variables.
    """
    return self.day_format

def get_next_day(self, date): DayMixin

Get the next valid day.
160
161
162
163
164
def get_next_day(self, date):
    """
    Get the next valid day.
    """
    return _get_next_prev(self, date, is_previous=False, period='day')

def get_previous_day(self, date): DayMixin

Get the previous valid day.
166
167
168
169
170
def get_previous_day(self, date):
    """
    Get the previous valid day.
    """
    return _get_next_prev(self, date, is_previous=True, period='day')