#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 akaariai):

 The latest solution is close to what charettes suggested in comment:3. The
 biggest distinctions are that pre_update is given the to-be updated
 queryset instead of to-be-updated queryset.filter(pk_in=pk_set), and for
 post_update you don't get queryset, you just get pk_set.

 The reason for going with pk_set is that in some cases the only thing you
 need is the set of primary keys, and if that happens to be a large set,
 then doing pk_in=pk_set query will be expensive (PostgreSQL doesn't like
 this type of query at all, and SQLite will not even execute a query with
 more than 1000 pk values.

 A possible solution is to provide both the queryset (with pk_in=pk_set
 filtering pre-applied), *and* the pk_set to pre_/post_ update signals.
 That way the user has nice API if that is all that is needed, but can also
 just use the pk_set if that is possible.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/21461#comment:7>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.1974afcaa30b14dc46292a6be12db01c%40djangoproject.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to