mirror of https://github.com/django/django.git
Fixed #4404 -- Fixed LatestCommentsFeed query problem. Thanks, SmileyChris.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5408 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
63a1304f54
commit
8728e0f353
|
@ -23,16 +23,19 @@ class LatestFreeCommentsFeed(Feed):
|
||||||
self._site = Site.objects.get_current()
|
self._site = Site.objects.get_current()
|
||||||
return "Latest comments on %s" % self._site.name
|
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):
|
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):
|
class LatestCommentsFeed(LatestFreeCommentsFeed):
|
||||||
"""Feed of latest free comments on the current site"""
|
"""Feed of latest free comments on the current site"""
|
||||||
|
|
||||||
comments_class = Comment
|
comments_class = Comment
|
||||||
|
|
||||||
def items(self):
|
def get_query_set(self):
|
||||||
qs = LatestFreeCommentsFeed.items(self)
|
qs = super(LatestCommentsFeed, self).get_query_set()
|
||||||
qs = qs.filter(is_removed=False)
|
qs = qs.filter(is_removed=False)
|
||||||
if settings.COMMENTS_BANNED_USERS_GROUP:
|
if settings.COMMENTS_BANNED_USERS_GROUP:
|
||||||
where = ['user_id NOT IN (SELECT user_id FROM auth_users_group WHERE group_id = %s)']
|
where = ['user_id NOT IN (SELECT user_id FROM auth_users_group WHERE group_id = %s)']
|
||||||
|
|
Loading…
Reference in New Issue