summaryrefslogtreecommitdiff
path: root/bak/unused_apps/jrnl/build.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /bak/unused_apps/jrnl/build.py
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'bak/unused_apps/jrnl/build.py')
-rw-r--r--bak/unused_apps/jrnl/build.py100
1 files changed, 100 insertions, 0 deletions
diff --git a/bak/unused_apps/jrnl/build.py b/bak/unused_apps/jrnl/build.py
new file mode 100644
index 0000000..dcebace
--- /dev/null
+++ b/bak/unused_apps/jrnl/build.py
@@ -0,0 +1,100 @@
+from django.urls import reverse
+from django.apps import apps
+from builder.base import BuildNew
+from itertools import chain
+
+from django.conf import settings
+
+
+class BuildJrnl(BuildNew):
+
+ def build(self):
+ self.build_list_view(
+ base_path=reverse("jrnl:list"),
+ paginate_by=24
+ )
+ self.build_year_view("jrnl:list_year")
+ self.build_month_view("jrnl:list_month")
+ self.build_detail_view()
+ self.build_location_view()
+ self.build_feed("jrnl:feed")
+ self.build_latest()
+
+ def build_arc(self):
+ self.build_list_view(
+ base_path=reverse("jrnl:list"),
+ paginate_by=24
+ )
+ self.build_year_view("jrnl:list_year")
+ self.build_month_view("jrnl:list_month")
+ self.build_location_view()
+
+ def build_location_view(self):
+ c = apps.get_model('locations', 'Country')
+ r = apps.get_model('locations', 'Region')
+ countries = c.objects.filter(visited=True)
+ regions = r.objects.all()
+ locations = list(chain(countries, regions))
+ for c in locations:
+ try:
+ qs = self.model.objects.filter(
+ status__exact=1,
+ location__state__country=c
+ )
+ except:
+ qs = self.model.objects.filter(
+ status__exact=1,
+ location__state__country__lux_region=c.id
+ )
+ print(c)
+ pages = self.get_pages(qs, 24)
+ for page in range(pages):
+ base_path = reverse("jrnl:list_country", kwargs={'slug': c.slug, 'page': page + 1})
+ response = self.client.get(base_path)
+ print(response.content)
+ if page == 0:
+ self.write_file(base_path, response.content)
+ else:
+ self.write_file(base_path, response.content)
+
+ def build_homepage(self):
+ response = self.client.get('/')
+ self.write_file('', response.content)
+
+ def build_latest(self):
+ response = self.client.get('/jrnl/latest/')
+ self.write_file(reverse("jrnl:latest"), response.content)
+
+ def build_map(self):
+ self.build_list_view(
+ base_path=reverse("map:maplist"),
+ paginate_by=1000000
+ )
+ response = self.client.get(reverse("map:mapdata"))
+ self.write_file("media/js/mainmap", response.content, 'js', '')
+
+
+def archive_builder():
+ j = BuildJrnl("jrnl", "entry")
+ j.build_arc()
+
+
+def detail_builder():
+ j = BuildJrnl("jrnl", "entry")
+ j.build_latest()
+ j.build_detail_view()
+
+
+def home_builder():
+ j = BuildJrnl("jrnl", "entry")
+ j.build_homepage()
+
+
+def rss_builder():
+ j = BuildJrnl("jrnl", "entry")
+ j.build_feed("jrnl:feed")
+
+
+def map_builder():
+ j = BuildJrnl("jrnl", "entry")
+ j.build_map()