mirror of
https://github.com/Hopiu/django-cachalot.git
synced 2026-05-04 19:04:43 +00:00
Adds a check enforcing the Django version.
This commit is contained in:
parent
8bb1ca1753
commit
50ff4ada3c
1 changed files with 13 additions and 0 deletions
|
|
@ -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]
|
||||
|
|
|
|||
Loading…
Reference in a new issue