Fixed #34458 -- Fixed QuerySet.defer() crash on attribute names.

Thanks Andrew Cordery for the report.

Regression in b3db6c8dcb.
This commit is contained in:
Simon Charette 2023-04-04 16:58:15 -04:00 committed by Mariusz Felisiak
parent ff9ceed32b
commit 87c63bd8df
3 changed files with 9 additions and 2 deletions

View file

@ -702,7 +702,8 @@ class Query(BaseExpression):
# by recursively calling this function.
for field in opts.concrete_fields:
field_mask = mask.pop(field.name, None)
if field_mask is None:
field_att_mask = mask.pop(field.attname, None)
if field_mask is None and field_att_mask is None:
select_mask.setdefault(field, {})
elif field_mask:
if not field.is_relation: