#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)
Change History (4)
by , 18 years ago
| Attachment: | django_comments_patch.diff added |
|---|
comment:1 by , 18 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 , 18 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
the patch to comments.models