mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
[4.0.x] Fixed #33680 -- Corrected example of customizing model loading in docs.
Backport of faab9e6769
from main
This commit is contained in:
parent
256db5c048
commit
8b2a93ee5b
1 changed files with 3 additions and 1 deletions
|
@ -103,7 +103,9 @@ are loaded from the database::
|
|||
instance._state.adding = False
|
||||
instance._state.db = db
|
||||
# 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
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue