blob: d61c78a03486d0de78374423219419e66e3de004 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
from django.urls import reverse
from builder.base import BuildNew
from .models import Sighting
class BuildSightings(BuildNew):
def build(self):
self.build_detail_view()
self.build_list_view(
base_path=reverse("sightings:list"),
paginate_by=24
)
def get_model_queryset(self):
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():
j = BuildSightings("sightings", "sighting")
j.build()
|