Skip to content

Commit

Permalink
Now checking if app_label is instance of BaseModel instead of not str.
Browse files Browse the repository at this point in the history
…Fixes #285.
  • Loading branch information
bernardopires committed Sep 19, 2015
1 parent 85ef2f4 commit e8649f3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tenant_schemas/routers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf import settings

from django.db.models.base import ModelBase

class TenantSyncRouter(object):
"""
Expand All @@ -13,8 +13,8 @@ def allow_migrate(self, db, app_label, model_name=None, **hints):
from django.db import connection
from tenant_schemas.utils import get_public_schema_name, app_labels

if not isinstance(app_label, str):
# In django 1.7 the `app_label` parameter is actually `model`
if isinstance(app_label, ModelBase):
# In django <1.7 the `app_label` parameter is actually `model`
app_label = app_label._meta.app_label

if connection.schema_name == get_public_schema_name():
Expand Down

0 comments on commit e8649f3

Please sign in to comment.