summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/books/build.py35
-rw-r--r--app/books/urls.py4
-rw-r--r--app/builder/base.py1
-rw-r--r--app/builder/views.py5
4 files changed, 41 insertions, 4 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"
),
]
diff --git a/app/builder/base.py b/app/builder/base.py
index 863a4da..c3da573 100644
--- a/app/builder/base.py
+++ b/app/builder/base.py
@@ -465,6 +465,7 @@ class BuildBooks(Build):
def build_book_archive_pages(self):
qs = apps.get_model('books', 'Book').objects.all().order_by('-read_date').select_related()
+ print(qs)
self.build_archive_pages(qs, 'books/', 18)
diff --git a/app/builder/views.py b/app/builder/views.py
index a17ec1b..fe68816 100644
--- a/app/builder/views.py
+++ b/app/builder/views.py
@@ -1,9 +1,10 @@
from django.shortcuts import render_to_response
from django.template import RequestContext
-from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap, BuildPages, BuildBooks
+from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap, BuildPages
from src.build import builder as src_build
from jrnl.build import BuildJrnl, build_arc, build_detail
from resume.build import builder as resume_builder
+from books.build import builder as book_builder
options = {
'writing': BuildWriting,
@@ -36,7 +37,7 @@ def do_build(request):
BuildWriting().build_homepage()
elif section == 'buildbooks':
context = {'message': 'Writing Book Pages to Disk'}
- BuildBooks().build()
+ book_builder()
elif section == 'src':
context = {'message': 'Writing src section to Disk'}
src_build()