Code

Ticket #4189: comments.py.diff

File comments.py.diff, 1.1 KB (added by Brett Hoerner <bretthoerner@…>, 7 years ago)

COMMENTS_BANNED_USERS_GROUP / ORM patch

Line 
1Index: django/contrib/comments/templatetags/comments.py
2===================================================================
3--- django/contrib/comments/templatetags/comments.py    (revision 925)
4+++ django/contrib/comments/templatetags/comments.py    (working copy)
5@@ -109,9 +109,9 @@
6             'site__id__exact': settings.SITE_ID,
7         }
8         kwargs.update(self.extra_kwargs)
9+        comment_list = get_list_function(**kwargs).order_by(self.ordering + 'submit_date').select_related()
10         if not self.free and settings.COMMENTS_BANNED_USERS_GROUP:
11-            kwargs['select'] = {'is_hidden': 'user_id IN (SELECT user_id FROM auth_user_groups WHERE group_id = %s)' % settings.COMMENTS_BANNED_USERS_GROUP}
12-        comment_list = get_list_function(**kwargs).order_by(self.ordering + 'submit_date').select_related()
13+            comment_list = comment_list.extra(select={'is_hidden': 'user_id IN (SELECT user_id FROM auth_user_groups WHERE group_id = %s)' % settings.COMMENTS_BANNED_USERS_GROUP})
14 
15         if not self.free:
16             if context.has_key('user') and context['user'].is_authenticated():