Opened 9 years ago
Closed 9 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 , 9 years ago
| Needs documentation: | set | 
|---|---|
| Needs tests: | set | 
comment:2 by , 9 years ago
| Owner: | changed from to | 
|---|---|
| Status: | new → assigned | 
comment:3 by , 9 years ago
| Triage Stage: | Unreviewed → Someday/Maybe | 
|---|
comment:4 by , 9 years ago
| Resolution: | → wontfix | 
|---|---|
| Status: | assigned → closed | 
I haven't seen an argument for fixing this instead of #21461.
The django-developers discussion hasn't yielded consensus about adding this (PR).