from django.urls import reverse from django.apps import apps from builder.base import BuildNew from itertools import chain from django.conf import settings from .models import PostType class BuildSrc(BuildNew): def get_model_queryset(self): return self.model.objects.filter(post_type=PostType.SRC).filter(status__exact=1).order_by('-pub_date') def build(self): self.build_list_view( base_path=reverse("src:list"), paginate_by=50 ) self.build_detail_view() def src_builder(): j = BuildSrc("posts", "post") j.build() class BuildGuide(BuildNew): def get_model_queryset(self): return self.model.objects.filter(post_type__in=[PostType.FIELD_TEST, PostType.REVIEW]).filter(status__exact=1).order_by('-pub_date') def build(self): self.build_list_view( base_path=reverse("guides:guide-base"), paginate_by=50 ) self.build_detail_view() def guide_builder(): j = BuildGuide("posts", "post") j.build() class BuildFieldNotes(BuildNew): def get_model_queryset(self): return self.model.objects.filter(post_type=PostType.FIELD_NOTE).filter(status__exact=1).order_by('-pub_date') def build(self): self.build_detail_view() self.build_list_view( base_path=reverse("fieldnotes:list"), paginate_by=24 ) self.build_year_view("fieldnotes:list_year") self.build_month_view("fieldnotes:list_month") def fieldnotes_builder(): j = BuildFieldNotes("posts", "post") j.build()