#11226 closed (fixed)
Name clashes in ManyToMany
Reported by: | pkoch | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Keywords: | ManyToMany name clash | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When both sides of a ManyToMany relation are of different classes and have the same object_name, a clash occours.
To reproduce:
- Create two apps, legacy and next_gen,
- Create a Model with the same name on both,
- Create a ManyToMany between them, and
- Run manage.py syncdb
My first take on a solution is in the attached patch.
Attachments (3)
Change History (10)
by , 16 years ago
Attachment: | m2m_name_clashes.diff added |
---|
comment:1 by , 16 years ago
Needs tests: | set |
---|---|
Patch needs improvement: | set |
Triage Stage: | Unreviewed → Accepted |
Interesting edge case. However, patch needs tests - I would suggest the m2m_regress regression test defining a User model with an m2m to contrib.auth.User.
by , 16 years ago
Attachment: | 11226-auto_m2m_table_fk_names_clash.diff added |
---|
Fix by pkoch plus a (simple) test as suggested by Russell
comment:2 by , 16 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
by , 15 years ago
Attachment: | 11226-r12343.diff added |
---|
Patch updated to current trunk. Includes tests, fixes a related validation that was wrongly being triggered and a couple of docstrings typo fixes.
comment:4 by , 15 years ago
milestone: | → 1.2 |
---|
comment:5 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Sugested solution