summaryrefslogtreecommitdiff
path: root/app/books
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2015-12-03 11:06:47 -0500
committerluxagraf <sng@luxagraf.net>2015-12-03 11:06:47 -0500
commit657d719bfdc33c8b01a430ea3f58a4907c558f9d (patch)
tree073b4f489c49588103e5ce13bcaddc683c4494cb /app/books
parent99ccbac9e4b96524aa33b5005ce3f7aa029126f6 (diff)
moved books to new build system
Diffstat (limited to 'app/books')
-rw-r--r--app/books/build.py35
-rw-r--r--app/books/urls.py4
2 files changed, 37 insertions, 2 deletions
diff --git a/app/books/build.py b/app/books/build.py
new file mode 100644
index 0000000..6743e89
--- /dev/null
+++ b/app/books/build.py
@@ -0,0 +1,35 @@
+import os
+from django.core.urlresolvers import reverse
+from builder.base import BuildNew
+
+
+class BuildBooks(BuildNew):
+
+ def build(self):
+ self.build_detail_view()
+ self.build_list_view(
+ base_path=reverse("books:live_redirect"),
+ paginate_by=24
+ )
+ print("building books")
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
+ def build_detail_view(self):
+ '''
+ write out all the expenses for each trip
+ '''
+ for obj in self.get_model_queryset():
+ url = obj.get_absolute_url()
+ path, slug = os.path.split(url)
+ path = '%s/' % path
+ # write html
+ response = self.client.get(url)
+ print(path, slug)
+ self.write_file(path, response.content, filename=slug)
+
+
+def builder():
+ j = BuildBooks("books", "book")
+ j.build()
diff --git a/app/books/urls.py b/app/books/urls.py
index be075ab..89c125e 100644
--- a/app/books/urls.py
+++ b/app/books/urls.py
@@ -12,13 +12,13 @@ urlpatterns = [
name='list',
),
url(
- r'(?P<slug>[-\w]+)/$',
+ r'(?P<slug>[-\w]+)$',
views.BookDetailView.as_view(),
name='detail',
),
url(
r'^$',
RedirectView.as_view(url="/books/1/", permanent=False),
- name="live-redirect"
+ name="live_redirect"
),
]