diff options
author | luxagraf <sng@luxagraf.net> | 2019-01-23 11:40:13 -0600 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2019-01-23 11:40:13 -0600 |
commit | 98c7a7d7831cb898b764a28907594fdf969045f5 (patch) | |
tree | 4fe911c44c04fe84e4986fca769095afb77e3890 /app/resume/build.py | |
parent | c64a7d332fc39d2da93e412c72c459e8085c4d6d (diff) |
Fixed resume and pub builder
Diffstat (limited to 'app/resume/build.py')
-rw-r--r-- | app/resume/build.py | 49 |
1 files changed, 34 insertions, 15 deletions
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() |