m2m_changed throws unwanted signals on admin site
Reported by: |
orcun avsar <orc.avs@…> |
Owned by: |
nobody |
Component:
|
Uncategorized
|
Version:
|
1.2
|
Severity:
|
Normal
|
Keywords:
|
|
Cc:
|
cmawebsite@…
|
Triage Stage:
|
Unreviewed
|
Has patch:
|
no
|
Needs documentation:
|
no
|
Needs tests:
|
no
|
Patch needs improvement:
|
no
|
Easy pickings:
|
no
|
UI/UX:
|
no
|
After connecting m2m_changed to a callback, it throws pre_clear,post_clear,pre_add,post_add signals in order anytime model instance is saved (even if there are no changes on the m2m field). pre_add and post_add signals contains all pks added to m2m field, not just added or removed ones. It's still useful when catching post_add signal and see which related objects that object has (eg. when counting how many related objects there are). But it's not possible to see which object has been added or removed... I encountered problem on django admin site. I guess when admin site saves an object it clears all related objects first then adds them one-by-one so it's not possible to detect what has been added/removed.
Change History
(2)
Resolution: |
→ duplicate
|
Status: |
new → closed
|
Cc: |
cmawebsite@… added
|
Easy pickings: |
unset
|
Severity: |
→ Normal
|
Type: |
→ Uncategorized
|
UI/UX: |
unset
|
This is effectively a duplicate of #6707.