Use better version checks, fix #78

This commit is contained in:
Jannis Leidel 2016-09-20 09:48:45 +02:00
parent 279fba2635
commit f0cfdfa9ce
3 changed files with 6 additions and 6 deletions

View file

@ -7,13 +7,13 @@ from dbtemplates.models import Template
from dbtemplates.utils.cache import (cache, get_cache_key,
set_and_return, get_cache_notfound_key)
if django.get_version() >= '1.8':
from django.template.loaders.base import Loader as tLoaderCls
if django.VERSION[:2] >= (1, 8):
from django.template.loaders.base import Loader as BaseLoader
else:
from django.template.loader import BaseLoader as tLoaderCls # noqa
from django.template.loader import BaseLoader # noqa
class Loader(tLoaderCls):
class Loader(BaseLoader):
"""
A custom template loader to load templates from the database.

View file

@ -12,7 +12,7 @@ class Migration(migrations.Migration):
('sites', '0001_initial'),
]
if django.get_version() >= '1.8':
if django.VERSION[:2] >= (1, 8):
operations = [
migrations.CreateModel(
name='Template',

View file

@ -37,5 +37,5 @@ TEMPLATE_LOADERS = (
'dbtemplates.loader.Loader',
)
if django.get_version() <= '1.6':
if django.VERSION[:2] <= (1, 6):
TEST_RUNNER = 'discover_runner.DiscoverRunner'