Opened 15 years ago
Closed 14 years ago
#13706 closed (worksforme)
dbrouter uses wrong database on many2many addition
Reported by: | cheerios | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 1.2 |
Severity: | 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
DATABASE_ROUTERS = ['dbrouter.BRouter', 'dbrouter.ARouter',] (form submission) item.save() # B paper = Paper() paper.save() # B item.attachments.add(paper) # writes to A, fails
BRouter routes traffic to database B, Arouter falls back on 'default' database.
All models read/write fine (on both databases), but adding a many2many relation for a table that saves to B (with all FKs in B) won't work unless Arouter's (!) db_to_write() does assert/print model._meta.app_label
Attachments (1)
Change History (3)
comment:1 by , 14 years ago
by , 14 years ago
Attachment: | 13706_tests.diff added |
---|
Patch for multi-db tests showing things work as expected
comment:2 by , 14 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Can't reproduce what's been reported here with trunk as of now. Find attached the patch to our regressiontests/multiple_database tests implementing what I understand from the ticket description.
Please reopen only if you can provide a modified patch that shows your use case and error.
Please provide a more complete example.