class YearMixin
from django.views.generic.dates import YearMixin
Attributes
Defined in | |
---|---|
year = None
|
YearMixin |
year_format = '%Y'
|
YearMixin |
Methods
def
get_year(self):
YearMixin
¶
def
get_year(self):
YearMixin
¶
Return the year for which this view should display data
23 24 25 26 27 28 29 30 31 32 33 34 | def get_year(self):
"Return the year for which this view should display data"
year = self.year
if year is None:
try:
year = self.kwargs['year']
except KeyError:
try:
year = self.request.GET['year']
except KeyError:
raise Http404(_(u"No year specified"))
return year
|
def
get_year_format(self):
YearMixin
¶
def
get_year_format(self):
YearMixin
¶
Get a year format string in strptime syntax to be used to parse the year from url variables.
16 17 18 19 20 21 | def get_year_format(self):
"""
Get a year format string in strptime syntax to be used to parse the
year from url variables.
"""
return self.year_format
|