-
Notifications
You must be signed in to change notification settings - Fork 2
/
renderers.py
83 lines (82 loc) · 2.18 KB
/
renderers.py
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# from django_medusa.renderers import StaticSiteRenderer
#
# class HomeRenderer(StaticSiteRenderer):
# def get_paths(self):
# return frozenset([
# "/",
# "work/",
# "/logbook/",
# "/linked/",
# "/archive/",
# "/contact/",
# # "/cv/",
# ])
#
# renderers = [HomeRenderer, ]
#
#
# # =todo
# from hth.models import Entry
# from django.contrib.flatpages.models import FlatPage
#
# class EntryRenderer(StaticSiteRenderer):
# def get_paths(self):
# paths = ["/logbook/",]
#
# items = Entry.objects.filter(is_active=True, kind="A").order_by('-pub_date')
# for item in items:
# paths.append(item.get_absolute_url())
#
# return paths
#
# class WorkRenderer(StaticSiteRenderer):
# def get_paths(self):
# paths = ["/work/", ]
#
# items = FlatPage.objects.all()
# for item in items:
# paths.append(item.get_absolute_url())
#
# return paths
#
# class LinkRenderer(StaticSiteRenderer):
# def get_paths(self):
# paths = ["/linked/", ]
#
# items = Entry.objects.filter(is_active=True, kind="L").order_by('-pub_date')
# for item in items:
# paths.append(item.get_absolute_url())
#
# return paths
#
# renderers = [EntryRenderer, WorkRenderer, LinkRenderer,]
# =todo
# from hth.models import Entry
# from django.contrib.flatpages.models import FlatPage
#
# from itertools import chain
#
# class EntryRenderer(StaticSiteRenderer):
# def get_paths(self):
# paths = ["/", "/logbook/", "/work/", ]
# entry_list = []
# work_list = []
# result_list = list(chain(entry_list, work_list))
#
# entry_list = Entry.objects.filter(is_active=True).order_by('-pub_date')
# for entry in entry_list:
# paths.append(entry.get_absolute_url())
#
# work_list = FlatPage.objects.all()
# for work in work_list:
# paths.append(work.get_absolute_url())
#
# result_list = sorted(
# chain(entry_list, work_list),
# key=lambda instance: instance)
#
# return paths
#
# renderers = [EntryRenderer, ]
#
#