mirror of
https://github.com/jazzband/django-dbtemplates.git
synced 2026-03-16 22:20:28 +00:00
Django 4.x fixes
This commit is contained in:
parent
9f664ea43c
commit
e1e11c42cb
3 changed files with 10 additions and 3 deletions
|
|
@ -2,7 +2,10 @@ import posixpath
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.utils.translation import ungettext, ugettext_lazy as _
|
try:
|
||||||
|
from django.utils.translation import ungettext, ugettext_lazy as _
|
||||||
|
except ImportError:
|
||||||
|
from django.utils.translation import ngettext, gettext_lazy as _
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
||||||
from dbtemplates.conf import settings
|
from dbtemplates.conf import settings
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,11 @@ from django.contrib.sites.models import Site
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import signals
|
from django.db.models import signals
|
||||||
from django.template import TemplateDoesNotExist
|
from django.template import TemplateDoesNotExist
|
||||||
from django.utils.translation import ugettext_lazy as _
|
try:
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
except ImportError:
|
||||||
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ def get_cache_backend():
|
||||||
"""
|
"""
|
||||||
Compatibilty wrapper for getting Django's cache backend instance
|
Compatibilty wrapper for getting Django's cache backend instance
|
||||||
"""
|
"""
|
||||||
if django.VERSION[0] >= 3 and django.VERSION[1] >= 2:
|
if (django.VERSION[0] >= 3 and django.VERSION[1] >= 2) or django.VERSION[0] >= 4:
|
||||||
from django.core.cache import caches
|
from django.core.cache import caches
|
||||||
cache = caches.create_connection(settings.DBTEMPLATES_CACHE_BACKEND)
|
cache = caches.create_connection(settings.DBTEMPLATES_CACHE_BACKEND)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue