Commits

Andrés Reyes Monge committed 43b5a3c

- Añadiendo feeds

Comments (0)

Files changed (2)

+# -*- coding: utf-8 -*-
+
+from django.contrib.syndication.views import Feed
+from blog.models import Post
+from django.utils.feedgenerator import Atom1Feed
+
+class RssSiteNewsFeed(Feed):
+    title = "armonge"
+    link = "/blog/"
+    description = "Updates on changes and additions to chicagocrime.org."
+
+    def items(self):
+        return Post.published.all().order_by('-date_published')[:5]
+
+class AtomSiteNewsFeed(RssSiteNewsFeed):
+    feed_type = Atom1Feed
+    subtitle = RssSiteNewsFeed.description
 # -*- coding: utf-8 -*-
 from django.conf.urls import patterns, include, url
 from blog.views import PostDetailView, PostListView
+from blog.feeds import RssSiteNewsFeed, AtomSiteNewsFeed
+
 
 urlpatterns = patterns('blog.views',
+    (r'^rss/$', RssSiteNewsFeed()),
+    (r'^atom/$', AtomSiteNewsFeed()),
     url(r'^(?P<pk>\d+)/(?P<slug>[\w-]+)/$', PostDetailView.as_view(), name='blog_post_detail'),
     url(r'^(?P<tag>[\w-]+)/$', PostListView.as_view(), name='blog_post_list_by_tag'),
     url(r'$',PostListView.as_view(), name='blog_post_list'),