mirror of
https://github.com/jazzband/django-constance.git
synced 2026-03-16 22:40:24 +00:00
Added support for Django 4.1. (#487)
* Added Django 4.0 classifier. * Added support for Django 4.1.
This commit is contained in:
parent
55aed5d4d4
commit
7b59c64635
4 changed files with 13 additions and 7 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from django.db.models import signals
|
||||
from django.apps import AppConfig
|
||||
from django.apps import apps, AppConfig
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
|
||||
|
|
@ -18,13 +18,16 @@ class ConstanceConfig(AppConfig):
|
|||
to be able to check for permissions
|
||||
"""
|
||||
from django.conf import settings
|
||||
from django.contrib.auth.models import Permission
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
constance_dbs = getattr(settings, 'CONSTANCE_DBS', None)
|
||||
if constance_dbs is not None and using not in constance_dbs:
|
||||
return
|
||||
if ContentType._meta.installed and Permission._meta.installed:
|
||||
if (
|
||||
apps.is_installed('django.contrib.contenttypes') and
|
||||
apps.is_installed('django.contrib.auth')
|
||||
):
|
||||
ContentType = apps.get_model('contenttypes.ContentType')
|
||||
Permission = apps.get_model('auth.Permission')
|
||||
content_type, created = ContentType.objects.using(using).get_or_create(
|
||||
app_label='constance',
|
||||
model='config',
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class DatabaseBackend(Backend):
|
|||
self._autofill_timeout = settings.DATABASE_CACHE_AUTOFILL_TIMEOUT
|
||||
self._autofill_cachekey = 'autofilled'
|
||||
|
||||
if not self._model._meta.installed:
|
||||
if self._model._meta.app_config is None:
|
||||
raise ImproperlyConfigured(
|
||||
"The constance.backends.database app isn't installed "
|
||||
"correctly. Make sure it's in your INSTALLED_APPS setting.")
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -38,6 +38,8 @@ setup(
|
|||
'Framework :: Django :: 3.0',
|
||||
'Framework :: Django :: 3.1',
|
||||
'Framework :: Django :: 3.2',
|
||||
'Framework :: Django :: 4.0',
|
||||
'Framework :: Django :: 4.1',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: BSD License',
|
||||
'Natural Language :: English',
|
||||
|
|
|
|||
5
tox.ini
5
tox.ini
|
|
@ -1,7 +1,7 @@
|
|||
[tox]
|
||||
envlist =
|
||||
py{36,37,38,39,py3}-dj{22,30,31,32}-{unittest,pytest}
|
||||
py{38,39,310}-dj{40,main}-{unittest,pytest}
|
||||
py{38,39,310}-dj{40,41,main}-{unittest,pytest}
|
||||
py310-dj32-{unittest,pytest}
|
||||
|
||||
[testenv]
|
||||
|
|
@ -14,7 +14,8 @@ deps =
|
|||
dj30: Django>=3.0,<3.1
|
||||
dj31: Django>=3.1,<3.2
|
||||
dj32: Django>=3.2,<4
|
||||
dj40: Django>=4.0a,<4.1
|
||||
dj40: Django>=4.0,<4.1
|
||||
dj41: Django>=4.1b1,<4.2
|
||||
djmain: https://github.com/django/django/archive/main.tar.gz
|
||||
pytest: pytest
|
||||
pytest: pytest-cov
|
||||
|
|
|
|||
Loading…
Reference in a new issue