diff options
Diffstat (limited to 'app/sightings/views.py')
-rw-r--r-- | app/sightings/views.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/app/sightings/views.py b/app/sightings/views.py index 24c341d..c4aab46 100644 --- a/app/sightings/views.py +++ b/app/sightings/views.py @@ -1,6 +1,7 @@ from django.views.generic.detail import DetailView from django.views.generic import ListView from django.contrib.auth.models import User +from django.utils import timezone from utils.views import PaginatedListView,LuxDetailView from .models import AP, Sighting, FieldNote @@ -43,11 +44,18 @@ class NotLifeListView(ListView): class YearListView(ListView): - template_name = 'sightings/life-list.html' + template_name = 'sightings/year-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') + def get_context_data(self, **kwargs): + # Call the base implementation first to get a context + context = super(YearListView, self).get_context_data(**kwargs) + context['year'] = timezone.now().year + return context + + class SightingListUserView(PaginatedListView): template_name = 'archives/sightings.html' |