Skip to content

Commit

Permalink
Assume no tenant specific model can be created until a tenant model i…
Browse files Browse the repository at this point in the history
…s correctly configured.
  • Loading branch information
charettes committed Nov 25, 2014
1 parent 537248d commit 0bdabb5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion tenancy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ class TenantSpecificModel(with_metaclass(ABCMeta)):
@classmethod
def __subclasshook__(cls, subclass):
if isinstance(subclass, TenantModelBase):
tenant_model = get_tenant_model(False)
try:
tenant_model = get_tenant_model(False)
except ImproperlyConfigured:
# If the tenant model is not configured yet we can assume
# no specific models have been defined so far.
return False
tenant = getattr(subclass, tenant_model.ATTR_NAME, None)
return isinstance(tenant, tenant_model)
return NotImplemented
Expand Down

0 comments on commit 0bdabb5

Please sign in to comment.