Ticket #4189: comments.py.diff

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

COMMENTS_BANNED_USERS_GROUP / ORM patch

  • django/contrib/comments/templatetags/comments.py

     
    109109            'site__id__exact': settings.SITE_ID,
    110110        }
    111111        kwargs.update(self.extra_kwargs)
     112        comment_list = get_list_function(**kwargs).order_by(self.ordering + 'submit_date').select_related()
    112113        if not self.free and settings.COMMENTS_BANNED_USERS_GROUP:
    113             kwargs['select'] = {'is_hidden': 'user_id IN (SELECT user_id FROM auth_user_groups WHERE group_id = %s)' % settings.COMMENTS_BANNED_USERS_GROUP}
    114         comment_list = get_list_function(**kwargs).order_by(self.ordering + 'submit_date').select_related()
     114            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})
    115115
    116116        if not self.free:
    117117            if context.has_key('user') and context['user'].is_authenticated():
Back to Top