Adds a check enforcing the Django version.

This commit is contained in:
Bertrand Bordage 2018-05-04 20:50:13 +02:00
parent 8bb1ca1753
commit 50ff4ada3c

View file

@ -1,5 +1,6 @@
from __future__ import unicode_literals
from django import __version__ as django__version__, VERSION as django_version
from django.apps import AppConfig
from django.conf import settings
from django.core.checks import register, Tags, Warning, Error
@ -10,6 +11,18 @@ from .settings import (
SUPPORTED_ONLY)
@register(Tags.compatibility)
def check_django_version(app_configs, **kwargs):
if not (1, 11) <= django_version < (2, 1):
return [Error(
'Django %s is not compatible with this version of django-cachalot.'
% django__version__,
hint='Refer to the django-cachalot documentation to find '
'which versions are compatible.',
id='cachalot.E003')]
return []
@register(Tags.caches, Tags.compatibility)
def check_cache_compatibility(app_configs, **kwargs):
cache = settings.CACHES[cachalot_settings.CACHALOT_CACHE]