summaryrefslogtreecommitdiff
path: root/app/sightings/build.py
blob: 5321eff6533541c3e6eee8f4d244b02020b9af6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
from django.urls import reverse
from builder.base import BuildNew
from django.contrib.auth.models import User
from .models import Sighting


class BuildSightings(BuildNew):

    def build(self):
        users = User.objects.all()
        self.build_detail_view()
        self.build_list_view(
            base_path=reverse("sightings:list"),
            paginate_by=24
        )
        #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()

def builder():
    j = BuildSightings("sightings", "sighting")
    j.build()