Hello everyone,  I got a problem

```
referenced_fields = set(chain.from_iterable(
(rf.attname for rf in rel.field.foreign_related_fields)
for rel in get_candidate_relations_to_delete(related_model._meta)
))
sub_objs = sub_objs.only(*tuple(referenced_fields))
```
It will never work, when delete a foreign key, it will select all fields.
it should not be like below code?
```
referenced_fields = set(rel.attname for rel in [f for f in 
related_model._meta.get_fields(include_hidden=True) if f.many_to_one])
sub_objs = sub_objs.only(*tuple(referenced_fields))
```

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4638a807-47b2-41fe-8da2-1185002fc8cfn%40googlegroups.com.

Reply via email to