magic-removal: Updated Manager in comments model to use .model instead of .klass
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2216 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
9dc4aa97ff
commit
c6db2578de
|
@ -209,8 +209,8 @@ class KarmaScoreManager(models.Manager):
|
||||||
def vote(self, user_id, comment_id, score):
|
def vote(self, user_id, comment_id, score):
|
||||||
try:
|
try:
|
||||||
karma = self.get_object(comment__id__exact=comment_id, user__id__exact=user_id)
|
karma = self.get_object(comment__id__exact=comment_id, user__id__exact=user_id)
|
||||||
except self.klass.DoesNotExist:
|
except self.model.DoesNotExist:
|
||||||
karma = self.klass(None, user_id, comment_id, score, datetime.datetime.now())
|
karma = self.model(None, user_id, comment_id, score, datetime.datetime.now())
|
||||||
karma.save()
|
karma.save()
|
||||||
else:
|
else:
|
||||||
karma.score = score
|
karma.score = score
|
||||||
|
@ -251,9 +251,9 @@ class UserFlagManager(models.Manager):
|
||||||
return # A user can't flag his own comment. Fail silently.
|
return # A user can't flag his own comment. Fail silently.
|
||||||
try:
|
try:
|
||||||
f = self.get_object(user__id__exact=user.id, comment__id__exact=comment.id)
|
f = self.get_object(user__id__exact=user.id, comment__id__exact=comment.id)
|
||||||
except self.klass.DoesNotExist:
|
except self.model.DoesNotExist:
|
||||||
from django.core.mail import mail_managers
|
from django.core.mail import mail_managers
|
||||||
f = self.klass(None, user.id, comment.id, None)
|
f = self.model(None, user.id, comment.id, None)
|
||||||
message = _('This comment was flagged by %(user)s:\n\n%(text)s') % {'user': user.username, 'text': comment.get_as_text()}
|
message = _('This comment was flagged by %(user)s:\n\n%(text)s') % {'user': user.username, 'text': comment.get_as_text()}
|
||||||
mail_managers('Comment flagged', message, fail_silently=True)
|
mail_managers('Comment flagged', message, fail_silently=True)
|
||||||
f.save()
|
f.save()
|
||||||
|
|
Loading…
Reference in New Issue