Fixed #31680 -- Removed unnecessary getattr() call in DeferredAttribute.__get__().

refresh_from_db() loads fields values.
This commit is contained in:
alosultan 2020-06-08 19:37:25 +03:00 committed by Mariusz Felisiak
parent 9bfa6a35f0
commit 678c8dfee4
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ class DeferredAttribute:
val = self._check_parent_chain(instance) val = self._check_parent_chain(instance)
if val is None: if val is None:
instance.refresh_from_db(fields=[field_name]) instance.refresh_from_db(fields=[field_name])
val = getattr(instance, field_name) else:
data[field_name] = val data[field_name] = val
return data[field_name] return data[field_name]