Skip to content

Commit

Permalink
Merge pull request #542 from wynnw/master
Browse files Browse the repository at this point in the history
Update admin support to handle apps with a customized label
  • Loading branch information
tomturner committed Apr 6, 2021
2 parents 0e9b566 + 179e1a8 commit 2b6989e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django_tenants/templatetags/tenant.py
@@ -1,3 +1,4 @@
from django.apps import apps
from django.conf import settings
from django.template import Library
from django.template.defaulttags import URLNode
Expand Down Expand Up @@ -35,7 +36,9 @@ def is_tenant_app(context, app):
return True
else:
_apps = settings.TENANT_APPS
return app['app_label'] in [tenant_app.split('.')[-1] for tenant_app in _apps]

cfg = apps.get_app_config(app['app_label'])
return cfg.module.__name__ in _apps


@register.simple_tag()
Expand All @@ -44,7 +47,9 @@ def is_shared_app(app):
_apps = get_tenant_types()[get_public_schema_name()]['APPS']
else:
_apps = settings.SHARED_APPS
return app['app_label'] in [tenant_app.split('.')[-1] for tenant_app in _apps]

cfg = apps.get_app_config(app['app_label'])
return cfg.module.__name__ in _apps


@register.simple_tag()
Expand Down

0 comments on commit 2b6989e

Please sign in to comment.