1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

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

View File

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