Opened 10 years ago
Last modified 10 years ago
#24998 closed Bug
ManyToManyField generating wrong query — at Version 1
Reported by: | Arthur Rio | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | ManyToManyField, bad query |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
If two models have a ManyToManyField pointing to the same model, the query generated for the lookup is incorrect. I have created a repo on github with a simple test (https://github.com/arthurio/manytomanybug/releases/tag/v1.0) and you can also find the code enclosed as a .zip file.
There are 3 models:
- Upload: that will be common to several other models.
- FormA with a ManyToManyField to the Upload model.
- FormB with a ManyToManyField to the Upload model.
When trying to do formAinstance.signature.all(), the query generated is using the FormB table to do the join instead of the FormA table.
Change History (3)
by , 10 years ago
Attachment: | manytomanybug-1.0.zip added |
---|
comment:1 by , 10 years ago
Description: | modified (diff) |
---|
Note:
See TracTickets
for help on using tickets.
Django project containing the test