summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-09-23 16:41:46 -0400
committerluxagraf <sng@luxagraf.net>2023-09-23 16:41:46 -0400
commitb42ddf2d3be18f9f67ded22775cc1823b55454fd (patch)
treecf271987f90bd79c5ca7717b041ece0ad659600e
parent2f36df5ee3b5899393738e7250d6fb917c9e02b1 (diff)
dialog: updated urls to include by year
-rw-r--r--app/sightings/urls.py5
-rw-r--r--app/sightings/views.py6
-rw-r--r--templates/archives/life-list.html2
3 files changed, 12 insertions, 1 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'
diff --git a/templates/archives/life-list.html b/templates/archives/life-list.html
index 9b92725..a485dfb 100644
--- a/templates/archives/life-list.html
+++ b/templates/archives/life-list.html
@@ -12,7 +12,7 @@
<li>Life List</li>
</ul>
<main role="main" class="archive">
- <h1 class="hide">Brids Life List {% if region %}in {%if region.name == 'United States'%}the United States{%else%}{{region.name|title|smartypants|safe}}{%endif%}{%else%} by {{user}}{%endif%}</h1>
+ <h1 class="hide">Birds Life List {% if region %}in {%if region.name == 'United States'%}the United States{%else%}{{region.name|title|smartypants|safe}}{%endif%}{%else%} by {{user}}{%endif%}</h1>
<div class="life-list">
<h4>Current Life List Total: {{object_list|length}}</h4>
<ul>{% for object in object_list %}