Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#6324 closed (fixed)

[patch] 'UserFlagManager' object has no attribute 'objects'

Reported by: deafwolf Owned by: nobody
Component: contrib.comments Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When I call UserFlag.objects.flag(comment, request.user), it throw a exception:
'UserFlagManager' object has no attribute 'objects'

--- django/contrib/comments/models.py	(revision 6996)
+++ django/contrib/comments/models.py	(working copy)
@@ -257,7 +257,7 @@
         if int(comment.user_id) == int(user.id):
             return # A user can't flag his own comment. Fail silently.
         try:
-            f = self.objects.get(user__pk=user.id, comment__pk=comment.id)
+           f = self.get(user__pk=user.id, comment__pk=comment.id)
         except self.model.DoesNotExist:
             from django.core.mail import mail_managers
             f = self.model(None, user.id, comment.id, None)

Attachments (1)

django_comments_patch.diff (653 bytes ) - added by Sam Bull <sbull@…> 17 years ago.
the patch to comments.models

Download all attachments as: .zip

Change History (4)

by Sam Bull <sbull@…>, 17 years ago

Attachment: django_comments_patch.diff added

the patch to comments.models

comment:1 by Sam Bull <sbull@…>, 17 years ago

It looks like this flag method used to live in UserFlag instead of in UserFlagManager, and this line is a hold-over from it's former life. As far as I can tell, UserFlag.objects.flag will never work because of this.

comment:2 by Gary Wilson, 17 years ago

Resolution: fixed
Status: newclosed

(In [7039]) Fixed #6324 -- Fixed get() call in UserFlagManager.flag().

comment:3 by anonymous, 16 years ago

kindy

Note: See TracTickets for help on using tickets.
Back to Top