0

I have in my Django project an app with two database.
So far I've done a router like this : Router Django.
My problem is that in the exemple they differ cases with the model app name :

   model._meta.app_label

But because all of my concerned models are in the same app I can't make the difference like this.

My question : Can I make the difference on the model class name ? With something like :

   model._meta.class_name

This way I could tell the database to use for every concerned models.
Thanks in advance for your help !

1 Answers1

0

I have found a way to do this.
I'll leave this here, if it may help someone !

Topic

You can simply import your models in the router.
Then you can compare them with the model in the router function and return the wanted database.

Hope this will help someone !