How can I configure models in Django which are being hosted in two different databases?
So far, I have 3 databases set up within my great Django environment. One of my apps uses a Router to automatically send data to the correct database -- this is easily done since this app only deals with that one database.
However, I have another app that uses two different databases. The app "controls" one of them, but gets data from a second that is updated through another application entirely.
I have tried adding an arbitrary attribute to the model's Meta class, to match against in the router, but this is not allowed in Django (as I discovered).
What data can I provide the model that can be matched against in the router, to know which database to go to?
db_nameattribute within the regular model, but not all models have the attribute (and system models can't be forced to have it). My router chokes when it reaches these, despite my attempts to verify the attributes existence. In this case, how to a verify the attribute that might not be defined?hasattrto check, or just try/except and catch the exception.