Ticket #4189: djt-4189-combined.diff
File djt-4189-combined.diff, 3.2 KB (added by , 18 years ago) |
---|
-
django/contrib/comments/templatetags/comments.py
111 111 'site__id__exact': settings.SITE_ID, 112 112 } 113 113 kwargs.update(self.extra_kwargs) 114 comment_list = get_list_function(**kwargs).order_by(self.ordering + 'submit_date').select_related() 114 115 if not self.free and settings.COMMENTS_BANNED_USERS_GROUP: 115 kwargs['select'] = {'is_hidden': 'user_id IN (SELECT user_id FROM auth_user_groups WHERE group_id = %s)' % settings.COMMENTS_BANNED_USERS_GROUP} 116 comment_list = get_list_function(**kwargs).order_by(self.ordering + 'submit_date').select_related() 116 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}) 117 117 118 118 if not self.free: 119 119 if 'user' in context and context['user'].is_authenticated(): -
django/contrib/comments/models.py
106 106 return "%s: %s..." % (self.user.username, self.comment[:100]) 107 107 108 108 def get_absolute_url(self): 109 return self.get_content_object().get_absolute_url() + "#c" + str(self.id) 109 try: 110 return self.get_content_object().get_absolute_url() + "#c" + str(self.id) 111 except AttributeError: 112 return "" 110 113 111 114 def get_crossdomain_url(self): 112 115 return "/r/%d/%d/" % (self.content_type_id, self.object_id) … … 191 194 return "%s: %s..." % (self.person_name, self.comment[:100]) 192 195 193 196 def get_absolute_url(self): 194 return self.get_content_object().get_absolute_url() + "#c" + str(self.id) 197 try: 198 return self.get_content_object().get_absolute_url() + "#c" + str(self.id) 199 except AttributeError: 200 return "" 195 201 196 202 def get_content_object(self): 197 203 """ -
django/contrib/comments/views/comments.py
112 112 'This comment was posted by a user who has posted fewer than %(count)s comments:\n\n%(text)s', settings.COMMENTS_FIRST_FEW) % \ 113 113 {'count': settings.COMMENTS_FIRST_FEW, 'text': c.get_as_text()} 114 114 mail_managers("Comment posted by rookie user", message) 115 if settings.COMMENTS_SKETCHY_USERS_GROUP and settings.COMMENTS_SKETCHY_USERS_GROUP in [g.id for g in self.user_cache.g et_group_list()]:115 if settings.COMMENTS_SKETCHY_USERS_GROUP and settings.COMMENTS_SKETCHY_USERS_GROUP in [g.id for g in self.user_cache.groups.all()]: 116 116 message = _('This comment was posted by a sketchy user:\n\n%(text)s') % {'text': c.get_as_text()} 117 117 mail_managers("Comment posted by sketchy user (%s)" % self.user_cache.username, c.get_as_text()) 118 118 return c