mirror of
https://github.com/django/django.git
synced 2025-07-07 11:19:12 +00:00
[4.0.x] Fixed #33680 -- Corrected example of customizing model loading in docs.
Backport of faab9e6769b01c18d9e3a31504601452eede6150 from main
This commit is contained in:
parent
256db5c048
commit
8b2a93ee5b
@ -103,7 +103,9 @@ are loaded from the database::
|
|||||||
instance._state.adding = False
|
instance._state.adding = False
|
||||||
instance._state.db = db
|
instance._state.db = db
|
||||||
# customization to store the original field values on the instance
|
# customization to store the original field values on the instance
|
||||||
instance._loaded_values = dict(zip(field_names, values))
|
instance._loaded_values = dict(
|
||||||
|
zip(field_names, (value for value in values if value is not DEFERRED))
|
||||||
|
)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user