[Django] #27809: Add pre_add and post_add signals

8 views
Skip to first unread message

Django

unread,
Feb 5, 2017, 2:26:29 PM2/5/17
to django-...@googlegroups.com
#27809: Add pre_add and post_add signals
-------------------------------------+-------------------------------------
Reporter: Oskar | Owner: nobody
Persson |
Type: New | Status: new
feature |
Component: Database | Version: master
layer (models, ORM) | Keywords: signals, many-to-
Severity: Normal | one
Triage Stage: | Has patch: 1
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 0 |
-------------------------------------+-------------------------------------
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
[https://docs.djangoproject.com/en/1.10/ref/models/relations/#django.db.models.fields.related.RelatedManager.add
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.

--
Ticket URL: <https://code.djangoproject.com/ticket/27809>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Feb 5, 2017, 2:27:30 PM2/5/17
to django-...@googlegroups.com
#27809: Add pre_add and post_add signals
-------------------------------------+-------------------------------------
Reporter: Oskar Persson | Owner: nobody
Type: New feature | Status: new
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: signals, many-to- | Triage Stage:
one | Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Oskar Persson):

* needs_docs: 0 => 1
* needs_tests: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/27809#comment:1>

Django

unread,
Feb 5, 2017, 2:29:52 PM2/5/17
to django-...@googlegroups.com
#27809: Add pre_add and post_add signals
-------------------------------------+-------------------------------------
Reporter: Oskar Persson | Owner: Oskar
| Persson
Type: New feature | Status: assigned

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: signals, many-to- | Triage Stage:
one | Unreviewed
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Oskar Persson):

* status: new => assigned
* owner: nobody => Oskar Persson


--
Ticket URL: <https://code.djangoproject.com/ticket/27809#comment:2>

Django

unread,
Feb 6, 2017, 12:19:24 PM2/6/17
to django-...@googlegroups.com
#27809: Add pre_add and post_add signals
-------------------------------------+-------------------------------------
Reporter: Oskar Persson | Owner: Oskar
| Persson
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution:
Keywords: signals, many-to- | Triage Stage:
one | Someday/Maybe

Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* stage: Unreviewed => Someday/Maybe


Comment:

The [https://groups.google.com/d/topic/django-
developers/eLHXeMj0_m4/discussion django-developers discussion] hasn't
yielded consensus about adding this
([https://github.com/django/django/pull/8018 PR]).

--
Ticket URL: <https://code.djangoproject.com/ticket/27809#comment:3>

Django

unread,
Feb 10, 2017, 11:51:20 AM2/10/17
to django-...@googlegroups.com
#27809: Add pre_add and post_add signals
-------------------------------------+-------------------------------------
Reporter: Oskar Persson | Owner: Oskar
| Persson
Type: New feature | Status: closed

Component: Database layer | Version: master
(models, ORM) |
Severity: Normal | Resolution: wontfix

Keywords: signals, many-to- | Triage Stage:
one | Someday/Maybe
Has patch: 1 | Needs documentation: 1
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: assigned => closed
* resolution: => wontfix


Comment:

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

--
Ticket URL: <https://code.djangoproject.com/ticket/27809#comment:4>

Reply all
Reply to author
Forward
0 new messages