Add feather icons and use them in the global nav, add RSS
[styx.blog] / core / views.py
index 168fa3e..731762c 100644 (file)
@@ -1,11 +1,27 @@
 import datetime
 
 from django.contrib.auth.models import User
+from django.contrib.syndication.views import Feed
+from django.utils.feedgenerator import Atom1Feed
 from django.views.generic.detail import DetailView
 from django.views.generic.list import ListView
 
 from . import models
 
+class AtomFeed(Feed):
+    feed_type = Atom1Feed
+
+    title = 'styx blog'
+    link = '/atom'
+    subtitle = 'styx blog'
+
+    def items(self):
+        now = datetime.datetime.utcnow()
+
+        return models.Post.objects.filter(
+            publication_utc__lte=now,
+        ).order_by('-publication_utc')
+
 class PostDetailView(DetailView):
     model = models.Post