mirror of
https://github.com/jazzband/django-admin2.git
synced 2026-03-16 22:20:24 +00:00
Should be ready to go!
This commit is contained in:
parent
bb127c9483
commit
03261fa461
1 changed files with 9 additions and 5 deletions
|
|
@ -257,11 +257,15 @@ class ModelListView(AdminModel2Mixin, generic.ListView):
|
|||
return context
|
||||
|
||||
def _format_years(self, context):
|
||||
return [
|
||||
(("?year=%s" % year.strftime("%Y")), year.strftime("%Y"))
|
||||
for year in
|
||||
context['object_list'].dates('published_date', 'year')
|
||||
]
|
||||
years = context['object_list'].dates('published_date', 'year')
|
||||
if len(years) == 1:
|
||||
return self._format_months(context)
|
||||
else:
|
||||
return [
|
||||
(("?year=%s" % year.strftime("%Y")), year.strftime("%Y"))
|
||||
for year in
|
||||
context['object_list'].dates('published_date', 'year')
|
||||
]
|
||||
|
||||
def _format_months(self, context):
|
||||
return [
|
||||
|
|
|
|||
Loading…
Reference in a new issue