From 8728e0f35398e05bba9956b5b85f7cc3fbf33143 Mon Sep 17 00:00:00 2001 From: Malcolm Tredinnick Date: Fri, 1 Jun 2007 11:58:17 +0000 Subject: [PATCH] Fixed #4404 -- Fixed LatestCommentsFeed query problem. Thanks, SmileyChris. git-svn-id: http://code.djangoproject.com/svn/django/trunk@5408 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/comments/feeds.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/django/contrib/comments/feeds.py b/django/contrib/comments/feeds.py index 34cf3d9cef3..1ad638469b5 100644 --- a/django/contrib/comments/feeds.py +++ b/django/contrib/comments/feeds.py @@ -23,16 +23,19 @@ class LatestFreeCommentsFeed(Feed): self._site = Site.objects.get_current() return "Latest comments on %s" % self._site.name + def get_query_set(self): + return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True) + def items(self): - return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True)[:40] + return self.get_query_set()[:40] class LatestCommentsFeed(LatestFreeCommentsFeed): """Feed of latest free comments on the current site""" comments_class = Comment - def items(self): - qs = LatestFreeCommentsFeed.items(self) + def get_query_set(self): + qs = super(LatestCommentsFeed, self).get_query_set() qs = qs.filter(is_removed=False) if settings.COMMENTS_BANNED_USERS_GROUP: where = ['user_id NOT IN (SELECT user_id FROM auth_users_group WHERE group_id = %s)']