mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
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)
This commit is contained in:
@@ -150,6 +150,10 @@ Minor features
|
||||
* Generic :class:`~django.contrib.gis.db.models.GeometryField` is now editable
|
||||
with the OpenLayers widget in the admin.
|
||||
|
||||
* The :meth:`Model.save() <django.db.models.Model.save()>` will do
|
||||
``UPDATE`` - if not updated - ``INSERT`` instead of ``SELECT`` - if not
|
||||
found ``INSERT`` else ``UPDATE`` in case the model's primary key is set.
|
||||
|
||||
Backwards incompatible changes in 1.6
|
||||
=====================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user