Commits

Anonymous committed 00f81ed

Tweaked the feed class
Added site to Post model
Named blog list URL pattern
Removed leftover import

  • Participants
  • Parent commits 0814adb

Comments (0)

Files changed (4)

gnocchi/blog/feeds.py

 from django.contrib.syndication.views import Feed
+from django.core.urlresolvers import reverse
 from gnocchi.blog.models import Post
 from taggit.models import TaggedItem
 
 class LatestBlogFeed(Feed):
     '''Basic feed configuration
 
-    You need to derive your own class from this to set link, and you will
-    probably also want to change description and title.
+    You need to derive your own class from this to set description and title.
 
-    See http://docs.djangoproject.com/en/1.2/ref/contrib/syndication/
+    See http://docs.djangoproject.com/en/1.3/ref/contrib/syndication/
     '''
     description = 'Blog Posts'
     title = 'Blog'
 
+    def link(self):
+        return reverse('blog-list')
+
     def categories(self):
         return TaggedItem.tags_for(Post)
 

gnocchi/blog/models.py

         related_name='blog_posts')
     published = models.BooleanField(default=False)
 
+    site = models.ForeignKey('sites.Site', null=True, blank=True)
+
     allow_comments = models.BooleanField(default=True)
 
     tags = TaggableManager(blank=True)

gnocchi/blog/urls.py

         PostDetail.as_view(),
         name='blog-detail',
     ),
-    url(r'^$', PostList.as_view(),),
+    url(r'^$', PostList.as_view(), name='blog-list'),
 )

gnocchi/blog/views.py

 from django.views.generic.dates import ArchiveIndexView, DateDetailView
 from django.http import HttpResponseRedirect
-from django.db.models import Q
 from gnocchi.blog import models, forms
 
 # This will roll for django-1.3
             return request.META['REMOTE_ADDR']
 
     def post(self, request, *args, **kwargs):
+        '''Lookie, Maw!  We use POST for what it was originally meant!'''
         self.object = post = self.get_object()
         form = forms.CommentForm(self._get_remote_ip(self.request), request.POST)
         if form.is_valid():