summaryrefslogtreecommitdiff
path: root/app/unused_apps/src/build.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2020-08-15 11:58:34 -0400
committerluxagraf <sng@luxagraf.net>2020-08-15 11:58:34 -0400
commitb66d000ee469539ce7aea557b612c0444177e36d (patch)
tree273547921dc6f9ded2a5681b82514c68e28ba448 /app/unused_apps/src/build.py
parentd3e57c1bd17ad3e71810235a672d4782136901a5 (diff)
archived old unused apps and migrated fieldnotes to posts
Diffstat (limited to 'app/unused_apps/src/build.py')
-rw-r--r--app/unused_apps/src/build.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/app/unused_apps/src/build.py b/app/unused_apps/src/build.py
new file mode 100644
index 0000000..a16bdaf
--- /dev/null
+++ b/app/unused_apps/src/build.py
@@ -0,0 +1,62 @@
+import os
+from builder.base import BuildNew
+from django.urls import reverse
+from . import models
+
+
+class BuildSrc(BuildNew):
+
+ def build(self):
+ self.build_list_view(
+ base_path=reverse("src:list"),
+ paginate_by=99999
+ )
+ self.build_list_view(
+ base_path=reverse("src:list_books"),
+ paginate_by=99999
+ )
+ self.build_detail_view()
+ # These are the unique classes for this model:
+ # self.build_books_view()
+ self.build_topic_view()
+ self.build_feed("src:feed")
+
+ def build_topic_view(self):
+ for topic in models.Topic.objects.all():
+ ctype = ContentType.objects.get(app_label='posts', model='post')
+ for cat in Category.objects.all():
+
+ url = reverse("src:list_topics", kwargs={'slug': topic.slug, })
+ path, slug = os.path.split(url)
+ response = self.client.get(url, HTTP_HOST='127.0.0.1')
+ self.write_file('%s/' % path, response.content, filename=slug)
+
+ def build_books_view(self):
+ for obj in models.Book.objects.all():
+ url = reverse("src:detail_book", kwargs={'slug': obj.slug, })
+ path, slug = os.path.split(url)
+ response = self.client.get(url, HTTP_HOST='127.0.0.1')
+ self.write_file('%s/' % path, response.content, filename=slug)
+
+
+def builder():
+ j = BuildSrc("src", "srcpost")
+ j.build()
+
+
+"""
+
+
+
+
+ def build_books(self):
+ path = 'src/books/'
+ c = Context({
+ 'object_list': Book.objects.filter(status__exact=1),
+ 'MEDIA_URL': settings.BAKED_MEDIA_URL,
+ 'IMAGES_URL': settings.BAKED_IMAGES_URL
+ })
+ t = render_to_string('archives/src_books.html', c).encode('utf-8')
+ self.write_file(path, t)
+
+"""