Opened 5 years ago

Closed 5 years ago

Last modified 7 months ago

#13962 closed Uncategorized (duplicate)

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

Description

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)

comment:1 Changed 5 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

This is effectively a duplicate of #6707.

comment:2 Changed 7 months ago by collinanderson

  • Cc cmawebsite@… added
  • Easy pickings unset
  • Severity set to Normal
  • Type set to Uncategorized
  • UI/UX unset

Yes #6707 should solve this issue. Closing as duplicate.

Note: See TracTickets for help on using tickets.
Back to Top