Code

Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#6324 closed (fixed)

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

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

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@…> 6 years ago.
the patch to comments.models

Download all attachments as: .zip

Change History (4)

Changed 6 years ago by Sam Bull <sbull@…>

the patch to comments.models

comment:1 Changed 6 years ago by Sam Bull <sbull@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 6 years ago by gwilson

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 5 years ago by anonymous

kindy

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.