diff options
| author | Taoup <mahongtao0x7e0@163.com> | 2020-01-29 23:06:56 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-29 16:06:56 +0100 |
| commit | efc1c73bf511cbebf03fa5b13fa3a98718daf928 (patch) | |
| tree | a8873dd1e222badc1843d7122445eaf860ae1873 | |
| parent | 1a9459b88e4b07b3f4dd80ed5987e13111afe1c2 (diff) | |
Simplified DeferredAttribute.__get__() a bit.
| -rw-r--r-- | django/db/models/query_utils.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py index 96409cc67c..4c6c48bf9d 100644 --- a/django/db/models/query_utils.py +++ b/django/db/models/query_utils.py @@ -141,7 +141,7 @@ class DeferredAttribute: return self data = instance.__dict__ field_name = self.field.attname - if data.get(field_name, self) is self: + if field_name not in data: # Let's see if the field is part of the parent chain. If so we # might be able to reuse the already loaded value. Refs #18343. val = self._check_parent_chain(instance) |
