Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #1981 -- Fixed bug in feeds.py for comments

git-svn-id: http://code.djangoproject.com/svn/django/trunk@2983 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit fd16f1468a0c5825bdd631e9a223601d65f429fb 1 parent d4f69f8
@adrianholovaty adrianholovaty authored
Showing with 9 additions and 15 deletions.
  1. +9 −15 django/contrib/comments/feeds.py
View
24 django/contrib/comments/feeds.py
@@ -5,7 +5,7 @@
from django.contrib.sites.models import Site
class LatestFreeCommentsFeed(Feed):
- """Feed of latest comments on the current site"""
+ "Feed of latest comments on the current site."
comments_class = FreeComment
@@ -25,24 +25,18 @@ def description(self):
return "Latest comments on %s" % self._site.name
def items(self):
- return self.comments_class.objects.filter(**self._get_lookup_kwargs())
-
- def _get_lookup_kwargs(self):
- return {
- 'site__pk': settings.SITE_ID,
- 'is_public__exact': True,
- 'limit': 40,
- }
+ return self.comments_class.objects.filter(site__pk=settings.SITE_ID, is_public=True)[:40]
class LatestCommentsFeed(LatestFreeCommentsFeed):
"""Feed of latest free comments on the current site"""
comments_class = Comment
- def _get_lookup_kwargs(self):
- kwargs = LatestFreeCommentsFeed._get_lookup_kwargs(self)
- kwargs['is_removed__exact'] = False
+ def items(self):
+ qs = LatestFreeCommentsFeed.items(self)
+ qs = qs.filter(is_removed=False)
if settings.COMMENTS_BANNED_USERS_GROUP:
- kwargs['where'] = ['user_id NOT IN (SELECT user_id FROM auth_users_group WHERE group_id = %s)']
- kwargs['params'] = [COMMENTS_BANNED_USERS_GROUP]
- return kwargs
+ where = ['user_id NOT IN (SELECT user_id FROM auth_users_group WHERE group_id = %s)']
+ params = [COMMENTS_BANNED_USERS_GROUP]
+ qs = qs.extra(where=where, params=params)
+ return qs
Please sign in to comment.
Something went wrong with that request. Please try again.