Ticket #1709: comments.diff
File comments.diff, 2.0 KB (added by , 19 years ago) |
---|
-
models.py
47 47 Returns a list of Comment objects matching the given lookup terms, with 48 48 _karma_total_good and _karma_total_bad filled. 49 49 """ 50 kwargs.setdefault('select', {}) 51 kwargs['select']['_karma_total_good'] = 'SELECT COUNT(*) FROM comments_karmascore WHERE comments_karmascore.comment_id=comments.id AND score=1' 52 kwargs['select']['_karma_total_bad'] = 'SELECT COUNT(*) FROM comments_karmascore WHERE comments_karmascore.comment_id=comments.id AND score=-1' 53 return self.filter(**kwargs) 50 extra_kwargs = {} 51 extra_kwargs.setdefault('select', {}) 52 extra_kwargs['select']['_karma_total_good'] = 'SELECT COUNT(*) FROM comments_karmascore, comments_comment WHERE comments_karmascore.comment_id=comments_comment.id AND score=1' 53 extra_kwargs['select']['_karma_total_bad'] = 'SELECT COUNT(*) FROM comments_karmascore, comments_comment WHERE comments_karmascore.comment_id=comments_comment.id AND score=-1' 54 return self.filter(**kwargs).extra(**extra_kwargs) 54 55 55 56 def user_is_moderator(self, user): 56 57 if user.is_superuser: -
views/comments.py
108 108 c.save() 109 109 # If the commentor has posted fewer than COMMENTS_FIRST_FEW comments, 110 110 # send the comment to the managers. 111 if self.user_cache. get_comments_comment_count() <= settings.COMMENTS_FIRST_FEW:111 if self.user_cache.comment_set.count() <= settings.COMMENTS_FIRST_FEW: 112 112 message = ngettext('This comment was posted by a user who has posted fewer than %(count)s comment:\n\n%(text)s', 113 113 'This comment was posted by a user who has posted fewer than %(count)s comments:\n\n%(text)s') % \ 114 114 {'count': settings.COMMENTS_FIRST_FEW, 'text': c.get_as_text()}