#32509 closed Bug (needsinfo)
Manytomany relations not loaded even it exists
Reported by: | Amat Martínez | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 2.1 |
Severity: | Normal | Keywords: | manytomany, database |
Cc: | amatmv@… | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Hi,
we run a production ecommerce with an average of ~50k sessions per day. In the last few weeks we're facing a constant error in production where many queries are throwing the same error, but in different situations.
The error is: "Cannot resolve keyword <field> into field. Choices are: ..."
I acknowledge that this error is thrown whenever we're trying to join a table through a field that doesn't exist in the model, but the thing is that now we daily get thousands of this error in different situations, apparently in random parts of the code.
I also know that there is the method prefetch_related
that loads the M2M relations, but are we supposed to -right now- do a deploy calling this method in all the places that we get the same error?
Thank you!!
Change History (2)
comment:1 by , 4 years ago
Component: | Core (Management commands) → Database layer (models, ORM) |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
comment:2 by , 4 years ago
Resolution: | worksforme → needsinfo |
---|
prefetch_related
is not related with the fields available on models.There is not enough details to reproduce the issue and prove it's an issue in Django. Also, Django 2.1 is not supported anymore. Can you reproduce this issue with Django 3.1+ and provide a small sample project?