routing a manytomany table to a non-default db in django
I'm using django's multi-db support via database routers to partition certain models to 1 db, and others into another. (Note that whether I "should" be doing that is irrelevant to my question.) I have 2 models in the same, non-default database, and they have a many-to-many relationship (via a ManyToManyField on one of them). I would like the table that gets created due to the m2m relationship to be created in the same db as the 2 models, but there doesn't seem to be a straightforward way of doing that -- the database routers functionality only allows routing based on a model. Both models are being routed correctly, but not the m2m table.
I could set up the m2m field to use an intermediate model so I can route that model to the appropriate db, but I'd rather not do that i开发者_高级运维f I can avoid it since it eliminates the simple add, remove, etc functions normally available for m2m fields.
Is there another way to do this? If not, is this something worth creating a ticket about?
精彩评论