#29615: post_remove action is called even though there's no relation
-------------------------------------+-------------------------------------
Reporter: | Owner: nobody
nirmalraghavan |
Type: | Status: new
Uncategorized |
Component: Database | Version: 2.0
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
Consider the following Model,
{{{
class MyModel(models.Model):
likes = models.ForeignKey(User)
}}}
Now if I add a user to the likes field as below,
myObj.likes.add(user)
my m2m_changed receiver method will be called in signals module with
action post_add. And if I try to add the same user again. nothing will
happen which is fine.
And when I try to remove the user as below,
myObj.likes.remove(user)
m2m_changed receiver method is called with action post_remove. And if I
try to remove the same user again, this time also m2m_changed receiver
method is called. Even if there's no such user exist in ManyToMany field,
django will emit post_remove signal.
--
Ticket URL: <https://code.djangoproject.com/ticket/29615>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/057.1dd1bb77b9d9c10c901b093950c5307e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.