Deal with backwards compatibility by exception.
This commit is contained in:
parent
c4e34cdfda
commit
bd99102e2e
|
@ -5,7 +5,6 @@ multi-tenant setting
|
||||||
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
|
||||||
from django import VERSION as DJANGO_VERSION
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
@ -17,15 +16,13 @@ from django.utils.encoding import force_bytes
|
||||||
|
|
||||||
from tenant_schemas.postgresql_backend.base import FakeTenant
|
from tenant_schemas.postgresql_backend.base import FakeTenant
|
||||||
|
|
||||||
DJANGO_1_9 = DJANGO_VERSION[0] == 1 and DJANGO_VERSION[1] >= 9
|
try:
|
||||||
|
|
||||||
if DJANGO_1_9:
|
|
||||||
from django.template import Origin
|
from django.template import Origin
|
||||||
|
|
||||||
|
|
||||||
def make_origin(engine, name, loader, template_name, dirs):
|
def make_origin(engine, name, loader, template_name, dirs):
|
||||||
return Origin(name=name, template_name=template_name, loader=loader)
|
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):
|
def make_origin(engine, name, loader, template_name, dirs):
|
||||||
return engine.make_origin(name, loader, template_name, dirs)
|
return engine.make_origin(name, loader, template_name, dirs)
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,11 @@
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
from django.conf import settings
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from tenant_schemas.utils import get_public_schema_name, get_tenant_model
|
from tenant_schemas.utils import get_public_schema_name, get_tenant_model
|
||||||
|
|
||||||
ALLOWED_TEST_DOMAIN = '.test.com'
|
ALLOWED_TEST_DOMAIN = '.test.com'
|
||||||
|
|
||||||
ALLOWED_TEST_DOMAIN = '.test.com'
|
|
||||||
|
|
||||||
|
|
||||||
class TenantTestCase(TestCase):
|
class TenantTestCase(TestCase):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
Loading…
Reference in New Issue