Opened 10 years ago
Last modified 10 years ago
#23624 closed New feature
Regression in ManyToManyField with through, runtime-generated models — at Initial Version
Reported by: | Ludovico Magnocavallo | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.7 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I admit my situation is a corner case: an app interfacing with a legacy db, where I need to extend an abstract model to contextualize it to identical tables, named differently (eg obj_1 table, obj_2 table, etc.), and to make things worse the number of tables is only known at runtime.
I am then dynamically generating a module for each set of models, and while things work great in Django 1.6, in 1.7 ManyToManyField using a through model breaks.
I am attaching a sample models.py file that illustrates the issue. I have not yet found the time to delve into what's happening, I hope someone with a better understanding of all the related stuff steps in as it's something I have never looked into.
models.py