Skip to content

Commit

Permalink
Merge pull request #332 from qdqmedia/upmaster
Browse files Browse the repository at this point in the history
router multidb fix
  • Loading branch information
bernardopires committed Sep 21, 2016
2 parents 5d33237 + 687ec7e commit 899bf60
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tenant_schemas/routers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.conf import settings
from django.db.models.base import ModelBase
from django.db.utils import load_backend


class TenantSyncRouter(object):
Expand All @@ -13,6 +14,12 @@ def allow_migrate(self, db, app_label, model_name=None, **hints):
# https://code.djangoproject.com/ticket/20704
from django.db import connection
from tenant_schemas.utils import get_public_schema_name, app_labels
from tenant_schemas.postgresql_backend.base import DatabaseWrapper as TenantDbWrapper

db_engine = settings.DATABASES[db]['ENGINE']
if not (db_engine == 'tenant_schemas.postgresql_backend' or
issubclass(getattr(load_backend(db_engine), 'DatabaseWrapper'), TenantDbWrapper)):
return None

if isinstance(app_label, ModelBase):
# In django <1.7 the `app_label` parameter is actually `model`
Expand Down

0 comments on commit 899bf60

Please sign in to comment.