summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-01-23 11:40:13 -0600
committerluxagraf <sng@luxagraf.net>2019-01-23 11:40:13 -0600
commit98c7a7d7831cb898b764a28907594fdf969045f5 (patch)
tree4fe911c44c04fe84e4986fca769095afb77e3890 /app
parentc64a7d332fc39d2da93e412c72c459e8085c4d6d (diff)
Fixed resume and pub builder
Diffstat (limited to 'app')
-rw-r--r--app/builder/views.py5
-rw-r--r--app/resume/build.py49
-rw-r--r--app/resume/urls.py33
3 files changed, 55 insertions, 32 deletions
diff --git a/app/builder/views.py b/app/builder/views.py
index c708778..d7d3659 100644
--- a/app/builder/views.py
+++ b/app/builder/views.py
@@ -3,7 +3,7 @@ from django.template import RequestContext
from builder.base import BuildWriting, BuildWritingFeed, BuildMap, BuildPhotos, BuildProjects, BuildSitemap
from src.build import builder as src_builder
from jrnl.build import archive_builder, detail_builder, home_builder, rss_builder, map_builder
-from resume.build import builder as resume_builder
+from resume.build import pub_builder, resume_builder
from books.build import builder as book_builder
from sightings.build import builder as sightings_builder
from photos.build import builder as photo_builder
@@ -33,6 +33,9 @@ def do_build(request):
elif section == 'resume':
context = {'message': 'Writing Resume to Disk'}
resume_builder()
+ elif section == 'pubs':
+ context = {'message': 'Writing Publications to Disk'}
+ pub_builder()
elif section == 'buildrss':
context = {'message': 'Writing RSS to Disk'}
rss_builder()
diff --git a/app/resume/build.py b/app/resume/build.py
index 285521a..4f051d5 100644
--- a/app/resume/build.py
+++ b/app/resume/build.py
@@ -6,12 +6,15 @@ from pages.models import Page
from .models import Publisher
-class BuildResume(BuildNew):
+class BuildPubs(BuildNew):
def build(self):
self.build_detail_view()
self.build_publisher_list()
- self.build_pages()
+ self.build_list_view(
+ base_path=reverse("resume:list"),
+ paginate_by=9999
+ )
def get_model_queryset(self):
return self.model.objects.all()
@@ -19,6 +22,7 @@ class BuildResume(BuildNew):
def build_detail_view(self):
for obj in self.get_model_queryset():
url = obj.get_absolute_url()
+ print(url)
path, slug = os.path.split(url)
path = '%s/' % path
# write html
@@ -30,27 +34,42 @@ class BuildResume(BuildNew):
publishers = Publisher.objects.all()
for publisher in publishers:
self.build_list_view(
- base_path=reverse("resume:live_publisher_redirect", kwargs={'publisher': publisher.slug, }),
+ base_path=reverse("resume:list_by_publisher", kwargs={'publisher': publisher.slug, }),
paginate_by=9999
)
+
+class BuildResume(BuildNew):
+
+ def build(self):
+ self.build_pages()
+
+ def get_model_queryset(self):
+ return self.model.objects.all()
+
def build_pages(self):
'''
- build out /resume and /resume/cv
+ build out /work/index.html and work/resume.html
'''
- pages = Page.objects.filter(app="resume")
+ pages = self.get_model_queryset().filter(app="resume", build=True)
for obj in pages:
- url = obj.get_absolute_url()
- path, slug = os.path.split(url)
- path = '%s/' % path
- # write html
- response = self.client.get(url)
- if obj.slug == "resume":
- path = "/resume/"
+ path = "work/"
+ if obj.slug == "profile":
+ url = '/work/'
slug = "index"
- print(path, slug)
+ else:
+ url = "/%s%s/" % (path, obj.slug)
+ slug = obj.slug
+ # write html
+ response = self.client.get(url, HTTP_HOST='127.0.0.1')
self.write_file(path, response.content, filename=slug)
-def builder():
- j = BuildResume("resume", "pubitem")
+
+def pub_builder():
+ j = BuildPubs("resume", "pubitem")
+ j.build()
+
+
+def resume_builder():
+ j = BuildResume("pages", "page")
j.build()
diff --git a/app/resume/urls.py b/app/resume/urls.py
index 0086a2b..de95866 100644
--- a/app/resume/urls.py
+++ b/app/resume/urls.py
@@ -7,16 +7,15 @@ app_name = "resume"
urlpatterns = [
path(
- r'',
- views.PageView.as_view(),
- {'path': 'work', 'slug': 'profile'},
- name="pages"
+ r'pubs/<str:publisher>/<int:page>/',
+ views.ByPublisherListView.as_view(),
+ name='list_by_publisher',
),
path(
- r'<str:slug>/',
- views.PageView.as_view(),
- {'path': 'work'},
- name="pages"
+ r'pubs/<str:publisher>/',
+ views.ByPublisherListView.as_view(),
+ {'page': 1},
+ name='list_by_publisher',
),
path(
r'pubs/<str:page>/',
@@ -30,18 +29,20 @@ urlpatterns = [
name="list"
),
path(
- r'pubs/<str:publisher>/<int:page>/',
- views.ByPublisherListView.as_view(),
- name='list_by_publisher',
- ),
- path(
r'pubs/<str:publisher>/<str:slug>',
views.PubItemDetailView.as_view(),
name='detail',
),
path(
- r'pubs/(?P<publisher>[-\w]+)/$',
- RedirectView.as_view(url="/resume/pubs/%(publisher)s/1/", permanent=False),
- name="live_publisher_redirect"
+ r'<str:slug>/',
+ views.PageView.as_view(),
+ {'path': 'work'},
+ name="pages"
+ ),
+ path(
+ r'',
+ views.PageView.as_view(),
+ {'path': 'work', 'slug': 'profile'},
+ name="pages"
),
]