diff options
Diffstat (limited to 'app/sightings')
-rw-r--r-- | app/sightings/views.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/app/sightings/views.py b/app/sightings/views.py index e97638f..cb821c8 100644 --- a/app/sightings/views.py +++ b/app/sightings/views.py @@ -4,11 +4,13 @@ from utils.views import PaginatedListView from .models import AP, Sighting from dal import autocomplete + class SightingListView(PaginatedListView): template_name = 'archives/sightings.html' def get_queryset(self): - return Sighting.objects.all() + qs_ids = Sighting.objects.order_by('ap__id', '-pub_date').distinct('ap').values_list('id', flat=True) + return Sighting.objects.filter(id__in=qs_ids).order_by('-pub_date') class SightingListUserView(PaginatedListView): |