From df359d2bfcf890751ec9f363a26da91360dca5b3 Mon Sep 17 00:00:00 2001 From: Gary Reynolds Date: Fri, 2 Jun 2017 17:56:37 +1000 Subject: [PATCH] Deal with backwards compatibility by exception. --- tenant_schemas/template_loaders.py | 9 +++------ tenant_schemas/test/cases.py | 1 - 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/tenant_schemas/template_loaders.py b/tenant_schemas/template_loaders.py index 4889edf..6224a26 100644 --- a/tenant_schemas/template_loaders.py +++ b/tenant_schemas/template_loaders.py @@ -5,7 +5,6 @@ multi-tenant setting import hashlib -from django import VERSION as DJANGO_VERSION from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import connection @@ -17,15 +16,13 @@ from django.utils.encoding import force_bytes from tenant_schemas.postgresql_backend.base import FakeTenant -DJANGO_1_9 = DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] >= 9 - -if DJANGO_1_9: +try: from django.template import Origin - def make_origin(engine, name, loader, template_name, dirs): return Origin(name=name, template_name=template_name, loader=loader) -else: + +except ImportError: # Django 1.8 backwards compatibility def make_origin(engine, name, loader, template_name, dirs): return engine.make_origin(name, loader, template_name, dirs) diff --git a/tenant_schemas/test/cases.py b/tenant_schemas/test/cases.py index d7a92f8..beef8dd 100644 --- a/tenant_schemas/test/cases.py +++ b/tenant_schemas/test/cases.py @@ -2,7 +2,6 @@ from django.conf import settings from django.core.management import call_command from django.db import connection from django.test import TestCase - from tenant_schemas.utils import get_public_schema_name, get_tenant_model ALLOWED_TEST_DOMAIN = '.test.com'