Opened 8 years ago

Closed 8 years ago

#27809 closed New feature (wontfix)

Add pre_add and post_add signals

Reported by: Oskar Persson Owned by: Oskar Persson
Component: Database layer (models, ORM) Version: dev
Severity: Normal Keywords: signals, many-to-one
Cc: Triage Stage: Someday/Maybe
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

There currently aren't any signals that are triggered when adding an object to a Many-To-One relation. This prevents a developer from adding additional custom functionality whenever this occurs. Currently the only way around this is using add with bulk=False which uses the save method instead of update, which isn't always what you want to use.

When bulk=True an update query is used which means that #21461 would also solve this issue. The problem with #21461 however is that there you want all the objects added to the relation sent with the signal. In the pre_add and post_add signals these aren't needed, here we only send the object that other objects are added to, the "related" object.

Change History (4)

comment:1 by Oskar Persson, 8 years ago

Needs documentation: set
Needs tests: set

comment:2 by Oskar Persson, 8 years ago

Owner: changed from nobody to Oskar Persson
Status: newassigned

comment:3 by Tim Graham, 8 years ago

Triage Stage: UnreviewedSomeday/Maybe

The django-developers discussion hasn't yielded consensus about adding this (PR).

comment:4 by Tim Graham, 8 years ago

Resolution: wontfix
Status: assignedclosed

I haven't seen an argument for fixing this instead of #21461.

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