diff --git a/entrouvert/djommon/multitenant/template_loader.py b/entrouvert/djommon/multitenant/template_loader.py index e88152b..e54978d 100644 --- a/entrouvert/djommon/multitenant/template_loader.py +++ b/entrouvert/djommon/multitenant/template_loader.py @@ -49,7 +49,7 @@ class CachedLoader(BaseLoader): if template_dirs: # If template directories were specified, use a hash to differentiate if connection.tenant: - key = '-'.join([str(connection.tenant.pk), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()]) + key = '-'.join([str(connection.tenant.schema_name), template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()]) else: key = '-'.join([template_name, hashlib.sha1(force_bytes('|'.join(template_dirs))).hexdigest()]) @@ -89,7 +89,7 @@ class FilesystemLoader(BaseLoader): raise ImproperlyConfigured('To use %s.%s you must define the TENANT_TEMPLATE_DIRS' % (__name__, FilesystemLoader.__name__)) for template_dir in template_dirs: try: - yield safe_join(template_dir, connection.tenant.domain_url, template_name) + yield safe_join(template_dir, connection.tenant.schema_name, 'templates', template_name) except UnicodeDecodeError: # The template dir name was a bytestring that wasn't valid UTF-8. raise