summaryrefslogtreecommitdiff
path: root/bak/unused_apps/src/build.py
diff options
context:
space:
mode:
Diffstat (limited to 'bak/unused_apps/src/build.py')
-rw-r--r--bak/unused_apps/src/build.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/bak/unused_apps/src/build.py b/bak/unused_apps/src/build.py
new file mode 100644
index 0000000..a16bdaf
--- /dev/null
+++ b/bak/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)
+
+"""