From f0cfdfa9cedfbe444d435cf93a92ea435c981641 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Tue, 20 Sep 2016 09:48:45 +0200 Subject: [PATCH] Use better version checks, fix #78 --- dbtemplates/loader.py | 8 ++++---- dbtemplates/migrations/0001_initial.py | 2 +- dbtemplates/test_settings.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dbtemplates/loader.py b/dbtemplates/loader.py index 4355772..5d1de78 100644 --- a/dbtemplates/loader.py +++ b/dbtemplates/loader.py @@ -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. diff --git a/dbtemplates/migrations/0001_initial.py b/dbtemplates/migrations/0001_initial.py index c307d7e..4d912be 100644 --- a/dbtemplates/migrations/0001_initial.py +++ b/dbtemplates/migrations/0001_initial.py @@ -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', diff --git a/dbtemplates/test_settings.py b/dbtemplates/test_settings.py index 2a358cf..0b53c97 100644 --- a/dbtemplates/test_settings.py +++ b/dbtemplates/test_settings.py @@ -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'