#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:
     Keywords:                       |  Unreviewed
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by charettes):

 IMO, until we add support for `RETURNING` (or equivalent on other
 backends) we should try to mimic the way delete works, that is.

 If no signals are attached to `(pre|post)_update` we do a ''fast update''.

 If it's not the case we fetch the pk of the objects we're about to update
 and use the retrieved list to:

 1. Build the queryset passed to `pre_update` receivers (`pk__in=pk_list`);
 2. Issue the update query (`WHERE pk IN pk_list`);
 3. Pass the `pk_list` to `post_update` receivers (actually this could also
 be a queryset built with `pk__in` instead of the `pk_list` itself).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21461#comment:3>
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.3f5b63f9e79865a7fe693b28abc8fac2%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to