#21461: Add pre_update and post_update signals
-------------------------------------+-------------------------------------
Reporter: loic84 | Owner: loic84
Type: New feature | Status: assigned
Component: Database layer | Version: master
(models, ORM) | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 1 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Comment (by shai):
While the idea in comment:11 is interesting, I think the current
suggestion is lacking.
First of all, returning values from signals breaks with well-established
assumptions, and I wouldn't haste to change that. Further, the suggested
code assumes without checking that the returned values can be used to
update a dictionary, and worse: Collapses all returned values into one
dictionary, allowing different signal handlers to step on each other's
toes with no way to find out about it.
I think that the general direction of letting the user specify which data
is received has merit, but this should be implemented via the registration
API -- that is, either defining different signals ('pre_update',
'pre_update_with_qset', 'pre_update_with_pks') or specifying different
senders (something along the lines of `@receiver(pre_update,
sender=(MyModel, pre_update.WITH_QSET))`). Then, update can calculate the
required data only if it is, in fact, requested.
--
Ticket URL: <https://code.djangoproject.com/ticket/21461#comment:13>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/064.83a7313345dd176468babc59e0c15f6d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.