diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/sightings/urls.py | 5 | ||||
-rw-r--r-- | app/sightings/views.py | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/app/sightings/urls.py b/app/sightings/urls.py index 7aa6ace..5cb9275 100644 --- a/app/sightings/urls.py +++ b/app/sightings/urls.py @@ -10,6 +10,11 @@ urlpatterns = [ {'page': 1}, name="list" ), + path( + r'life-list/<int:year>', + views.YearListView.as_view(), + name='list-by-year' + ), re_path( r'life-list$', views.LifeListView.as_view(), diff --git a/app/sightings/views.py b/app/sightings/views.py index 5e4de57..1c42fd4 100644 --- a/app/sightings/views.py +++ b/app/sightings/views.py @@ -20,6 +20,12 @@ class LifeListView(ListView): return Sighting.objects.filter(ap__apclass__kind=1).order_by('ap__id').distinct('ap') +class YearListView(ListView): + template_name = 'archives/life-list.html' + + def get_queryset(self): + return Sighting.objects.filter(ap__apclass__kind=1).filter(pub_date__year=self.kwargs['year']).order_by('ap__id').distinct('ap') + class SightingListUserView(PaginatedListView): template_name = 'archives/sightings.html' |