`use_query` doesn't work with fields using modified `related_name`
Archmonger opened this issue · 0 comments
Archmonger commented
Discussed in #121
Originally posted by numpde January 13, 2023
I have a model Compiled with a foreign key to Module, declared as follows:
parent = models.ForeignKey(Module, ..., related_name="compiled")
With use_query, this fails because it attempts to fetch compiled_set, I believe, due to this line in utils:
prefetch_fields.append(f"{field.name}_set")
Maybe it should be
prefetch_fields.append(field.related_name or f"{field.name}_set")