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:
Luke Plant 2006-02-01 18:47:12 +00:00
parent 9dc4aa97ff
commit c6db2578de
1 changed files with 4 additions and 4 deletions

View File

@ -209,8 +209,8 @@ class KarmaScoreManager(models.Manager):
def vote(self, user_id, comment_id, score):
try:
karma = self.get_object(comment__id__exact=comment_id, user__id__exact=user_id)
except self.klass.DoesNotExist:
karma = self.klass(None, user_id, comment_id, score, datetime.datetime.now())
except self.model.DoesNotExist:
karma = self.model(None, user_id, comment_id, score, datetime.datetime.now())
karma.save()
else:
karma.score = score
@ -251,9 +251,9 @@ class UserFlagManager(models.Manager):
return # A user can't flag his own comment. Fail silently.
try:
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
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()}
mail_managers('Comment flagged', message, fail_silently=True)
f.save()