diff options
author | luxagraf <sng@luxagraf.net> | 2023-09-23 16:41:46 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2023-09-23 16:41:46 -0400 |
commit | b42ddf2d3be18f9f67ded22775cc1823b55454fd (patch) | |
tree | cf271987f90bd79c5ca7717b041ece0ad659600e /app | |
parent | 2f36df5ee3b5899393738e7250d6fb917c9e02b1 (diff) |
dialog: updated urls to include by year
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' |