diff options
-rw-r--r-- | app/src/TODO | 2 | ||||
-rw-r--r-- | app/src/build.py | 9 | ||||
-rw-r--r-- | app/src/models.py | 13 | ||||
-rw-r--r-- | design/templates/feed.xml | 4 | ||||
-rw-r--r-- | design/templates/src_base.html | 4 |
5 files changed, 25 insertions, 7 deletions
diff --git a/app/src/TODO b/app/src/TODO index c6c7591..6fa16fa 100644 --- a/app/src/TODO +++ b/app/src/TODO @@ -1,5 +1,3 @@ add book detail page. redirect home book and rss -create separate rss for src -fix list formatting diff --git a/app/src/build.py b/app/src/build.py index ac77d0b..a60f80c 100644 --- a/app/src/build.py +++ b/app/src/build.py @@ -7,7 +7,7 @@ class BuildSrc(Build): self.build_archive() self.build_topic_archive() self.build_detail_pages() - + self.build_feed() def build_detail_pages(self): ''' @@ -42,3 +42,10 @@ class BuildSrc(Build): }) t = render_to_string('archives/src_home.html', c).encode('utf-8') self.write_file(path, t, 'html', topic.slug) + + def build_feed(self): + qs = Entry.objects.filter(status__exact=1) + c = Context({'object_list': qs, 'SITE_URL': settings.SITE_URL}) + t = render_to_string('feed.xml', c).encode('utf-8') + fpath = '%s' % ('/src/rss/',) + self.write_file(fpath, t, 'xml') diff --git a/app/src/models.py b/app/src/models.py index 6b5f476..ea70d86 100644 --- a/app/src/models.py +++ b/app/src/models.py @@ -1,5 +1,6 @@ from django.db import models from django.contrib.sitemaps import Sitemap +from django.contrib.syndication.views import Feed from blog.models import image_url_replace, extract_images import markdown import datetime @@ -103,6 +104,18 @@ class Book(models.Model): def get_absolute_url(self): return "/src/books/%s" % (self.slug) + +class LatestFull(Feed): + title = "luxagraf:src Code and Technology" + link = "/src/" + description = "Latest postings to luxagraf.net/src" + description_template = 'feeds/blog_description.html' + + def items(self): + return Entry.objects.filter(status__exact=1).order_by('-pub_date')[:10] + + + from itertools import chain class SrcSitemap(Sitemap): diff --git a/design/templates/feed.xml b/design/templates/feed.xml index d170cd3..44bf670 100644 --- a/design/templates/feed.xml +++ b/design/templates/feed.xml @@ -11,8 +11,8 @@ <lastBuildDate>{% now "D, d M Y H:i:00" %} GMT</lastBuildDate> <docs>http://cyber.law.harvard.edu/rss/rss.html</docs> <generator>IPpub v2.0</generator> - <managingEditor>contact@luxagraf.net</managingEditor> - <webMaster>contact@luxagraf.net</webMaster>{% for object in object_list %} + <managingEditor>sng@luxagraf.net</managingEditor> + <webMaster>sng@luxagraf.net</webMaster>{% for object in object_list %} <item> <title>{{object.title|escape}}</title> <link>{{SITE_URL}}{{object.get_absolute_url}}</link> diff --git a/design/templates/src_base.html b/design/templates/src_base.html index e7ee096..83ea7c2 100644 --- a/design/templates/src_base.html +++ b/design/templates/src_base.html @@ -13,8 +13,8 @@ <![endif]--> <link rel="alternate" type="application/rss+xml" - title="Luxagraf RSS feed" - href="https://luxagraf.net/rss/"> + title="Luxagraf:src RSS feed" + href="https://luxagraf.net/src/rss/"> {%block stylesheet%}<link rel="stylesheet" href="/media/screenv8.css" media="screen">{%endblock%} |