Django

Code

Ticket #6324 (closed: fixed)

Opened 1 year ago

Last modified 10 months ago

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

Reported by: deafwolf Assigned to: nobody
Milestone: Component: django.contrib.comments
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

django_comments_patch.diff (0.6 kB) - added by Sam Bull <sbull@trapeze.com> on 01/26/08 11:30:43.
the patch to comments.models

Change History

01/26/08 11:30:43 changed by Sam Bull <sbull@trapeze.com>

  • attachment django_comments_patch.diff added.

the patch to comments.models

01/26/08 11:34:48 changed by Sam Bull <sbull@trapeze.com>

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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.

01/27/08 23:29:10 changed by gwilson

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #6324 ([patch] 'UserFlagManager' object has no attribute 'objects')




Change Properties
Action