#17341: Model.save() commits transactions after every parent class save
-------------------------------------+-------------------------------------
     Reporter:  akaariai             |                    Owner:  Anssi
         Type:  Bug                  |  Kääriäinen <akaariai@…>
    Component:  Database layer       |                   Status:  closed
  (models, ORM)                      |                  Version:  1.3
     Severity:  Normal               |               Resolution:  fixed
     Keywords:                       |             Triage Stage:  Accepted
    Has patch:  1                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  1
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Anssi Kääriäinen <akaariai@…>):

 * owner:   => Anssi Kääriäinen <akaariai@…>
 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"6b4834952dcce0db5cbc1534635c00ff8573a6d8"]:
 {{{
 #!CommitTicketReference repository=""
 revision="6b4834952dcce0db5cbc1534635c00ff8573a6d8"
 Fixed #16649 -- Refactored save_base logic

 Model.save() will use UPDATE - if not updated - INSERT instead of
 SELECT - if found UPDATE else INSERT. This should save a query when
 updating, but will cost a little when inserting model with PK set.

 Also fixed #17341 -- made sure .save() commits transactions only after
 the whole model has been saved. This wasn't the case in model
 inheritance situations.

 The save_base implementation was refactored into multiple methods.
 A typical chain for inherited save is:
 save_base()
     _save_parents(self)
         for each parent:
             _save_parents(parent)
             _save_table(parent)
     _save_table(self)
 }}}

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


Reply via email to