summaryrefslogtreecommitdiff
path: root/app/pages/build.py
blob: f8988334d88b12de00a3b6a2f3dcdc943c076940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from django.template.loader import render_to_string
from django.template import Context
from django.urls import reverse
from django.conf import settings

from builder.base import BuildNew


class BuildPages(BuildNew):
    def build(self):
        self.build_detail_view()
        self.build_essays()
        print("building pages")

    def build_essays(self):
        qs = self.model.objects.filter(path="essays",build=True)
        c = {'object_list': qs, 'MEDIA_URL': settings.BAKED_MEDIA_URL, 'IMAGES_URL': settings.BAKED_IMAGES_URL}
        t = render_to_string('archives/essays.html', c).encode('utf-8')
        self.write_file('essays/', t)

    def get_model_queryset(self):
        return self.model.objects.filter(build=True)


def builder():
    j = BuildPages("pages", "Page")
    j.build()