diff options
-rw-r--r-- | app/sightings/urls.py | 5 | ||||
-rw-r--r-- | app/sightings/views.py | 6 | ||||
-rw-r--r-- | templates/archives/life-list.html | 2 |
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 %} |