dbrouter uses wrong database on many2many addition
|Reported by:||cheerios||Owned by:||nobody|
|Component:||Database layer (models, ORM)||Version:||1.2|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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