1. Scott Nixon
  2. article

Commits

Scott Nixon  committed 9b3305b

Migrated the Feed to the new synciation framework.

  • Participants
  • Parent commits d8c847e
  • Branches default

Comments (0)

Files changed (2)

File article/feeds.py

View file
  • Ignore whitespace
-from django.contrib.syndication.feeds import Feed
+from django.contrib.syndication.views import Feed
 from django.conf import settings
+from django.core.urlresolvers import reverse
 
-from article.models import Post, RecipePhotos
+from article.models import Post
 
 class LatestBlogPosts(Feed):
-    current_site = settings.SITE_ID
-    if settings.SITE_ID == 1:
-        title = "Happy Herbivore - Blog"
-        link = "http://happyherbivore.com/blog/"
-        description = "LEAF: Low Fat, Everyday, Affordable & Fast Recipes from Lindsay S. Nixon!"
-    elif settings.SITE_ID == 2:
-        title = "Herbisport - Blog"
-        link = "http://herbisport.com/blog/"
-        description = "Plant Based Energy for Athletes!"
+    title = "Happy Herbivore - Blog"
+    link = "http://happyherbivore.com/blog/"
+    description = "LEAF: Low Fat, Everyday, Affordable & Fast Recipes from Lindsay S. Nixon!"
 
     def items(self):
         return Post.active.filter(sites=settings.SITE_ID).filter(post_type__in=[1,4]).order_by('-published_on')[:5]
 
+    def item_title(self, item):
+        return item.post_title
+
+    def item_description(self, item):
+        return item.post_content
+
+    def item_link(self, item):
+        return "/{0}/{1}/{2}/".format(item.published_on.strftime('%Y'), item.published_on.strftime('%m'), item.post_slug)
+
+    def item_author_name(self, item):
+        return item.post_author.get_full_name()
+
     def item_pubdate(self, item):
         return item.published_on
+
+    item_copyright = 'Copyright (c) 2012, Happy Herbivore & Lindsay S. Nixon'

File article/urls.py

View file
  • Ignore whitespace
     url(r'^recipes/$', 'recipe_index', name="recipes-url"),
     url(r'^meals/(?P<name>[-\w]+)/$', 'meals'),
     url(r'^faq/$', 'faq_index'),
-    #url(r'^ingredients/$', 'ingred_type_index'),
-    #url(r'^ingredient/(?P<ingred_slug>[-\w]+)/$', 'recipes_by_ingred'),
     url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<post_slug>[-\w]+)/$',
-        'post_detail'),
+        'post_detail', name="post-detail-url"),
     url(r'^(?P<year>\d{4})/(?P<month>\d{2})/$', MonthArchiveView.as_view(model=Post, month_format='%m', date_field="published_on")),
     url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view()),
     url(r'^blog/archive/$', ArchiveIndexView.as_view(model=Post, date_field="published_on")),