diff options
-rw-r--r-- | app/sightings/build.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/app/sightings/build.py b/app/sightings/build.py index 14b363c..9ba758f 100644 --- a/app/sightings/build.py +++ b/app/sightings/build.py @@ -1,5 +1,6 @@ from django.urls import reverse from builder.base import BuildNew +from .models import Sighting class BuildSightings(BuildNew): @@ -8,18 +9,13 @@ class BuildSightings(BuildNew): self.build_detail_view() self.build_list_view( base_path=reverse("sightings:list"), - paginate_by=24 + paginate_by=18 ) - # for user in users: - # if Sighting.objects.filter(seen_by=user): - # self.build_list_view( - # base_path=reverse("sightings:list_by_person", kwargs={'user': user, 'page':1}), - # paginate_by=24 - # ) - # print("building sightings") def get_model_queryset(self): - return self.model.objects.all() + qs_ids = Sighting.objects.order_by('ap__id', '-pub_date').distinct('ap').values_list('id', flat=True) + qs = Sighting.objects.filter(id__in=qs_ids).order_by('-pub_date') + return qs def builder(): |