1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Fixed #18306 -- Made deferred models issue update_fields on save

Deferred models now automatically update only the fields which are
loaded from the db (with .only() or .defer()). In addition, any field
set manually after the load is updated on save.
This commit is contained in:
Andrei Antoukh
2012-08-12 22:17:54 +03:00
committed by Anssi Kääriäinen
parent 59a655988e
commit 99321e30ce
7 changed files with 161 additions and 0 deletions

View File

@@ -42,6 +42,10 @@ keyword argument ``update_fields``. By using this argument it is possible to
save only a select list of model's fields. This can be useful for performance
reasons or when trying to avoid overwriting concurrent changes.
Deferred instances (those loaded by .only() or .defer()) will automatically
save just the loaded fields. If any field is set manually after load, that
field will also get updated on save.
See the :meth:`Model.save() <django.db.models.Model.save()>` documentation for
more details.