summaryrefslogtreecommitdiff
path: root/app/builder/base.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2019-05-03 12:24:25 -0500
committerluxagraf <sng@luxagraf.net>2019-05-03 12:24:25 -0500
commite43cbc1a487b8ea45c05a4b394a7c60ffc4c0ba4 (patch)
tree8ef4800ef56bdadbc88158ec50f96e40b514b882 /app/builder/base.py
parent0e59ad7de18bffcf6a62f9ee61275b4951c27358 (diff)
added build system
Diffstat (limited to 'app/builder/base.py')
-rw-r--r--app/builder/base.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/builder/base.py b/app/builder/base.py
index 0d2cb0f..839c522 100644
--- a/app/builder/base.py
+++ b/app/builder/base.py
@@ -1,4 +1,6 @@
import os
+from operator import attrgetter
+from itertools import chain
from math import ceil
from decimal import Decimal
from django.test.client import Client
@@ -150,3 +152,18 @@ class BuildPages(BuildNew):
fpath = '%s' %(page.slug)
self.write_file('', t, 'html', page.slug)
self.write_file('', t, 'txt', page.slug)
+
+
+class BuildRSS(BuildNew):
+ def build(self):
+ entry_list = apps.get_model('blog', 'entry').objects.filter(status=1)
+ link_list = apps.get_model('links', 'link').objects.filter(status=1)
+ result_list = sorted(
+ chain(entry_list, link_list),
+ key=attrgetter('pub_date')
+ )
+ qs = reversed(result_list)
+ c = {'object_list': qs, 'SITE_URL': settings.SITE_URL}
+ t = render_to_string('feed.xml', c).encode('utf-8')
+ fpath = '%s' % ('rss/',)
+ self.write_file(fpath, t, 'xml')