diff options
author | luxagraf <sng@luxagraf.net> | 2018-05-27 16:24:35 -0500 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2018-05-27 16:24:35 -0500 |
commit | 8f4bbcbc391f318adb6eca5c538add126811feee (patch) | |
tree | 1ee4728e390ba25dd41614f2b16fc05e43f9eafd /app/sightings | |
parent | 8eb8f243025056092b9db646b8cf1e8d20b33549 (diff) |
fixed a bug in sightings builder
Diffstat (limited to 'app/sightings')
-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(): |