Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Django 3.2 and 4.0 deprecation warnings #289

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ajax_select/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,9 @@
# and any specified in settings.AJAX_LOOKUP_CHANNELS
# It will do this after all apps are imported.
from django.apps import AppConfig # noqa
default_app_config = 'ajax_select.apps.AjaxSelectConfig'

# Django 3.2+ does not need default_app_config set.
# Remove this once django <3.2 support is removed
import django
if django.VERSION < (3, 2):
default_app_config = 'ajax_select.apps.AjaxSelectConfig'
2 changes: 2 additions & 0 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"ENGINE": "django.db.backends.sqlite3",
}
}
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"

ROOT_URLCONF = "tests.urls"
INSTALLED_APPS = [
"django.contrib.auth",
Expand Down
6 changes: 3 additions & 3 deletions tests/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.conf import settings
from django.conf.urls import include, url
from django.urls import include, path
from django.conf.urls.static import static
from django.contrib import admin

Expand All @@ -8,6 +8,6 @@
admin.autodiscover()

urlpatterns = [
url(r'^ajax_lookups/', include(ajax_select_urls)),
url(r'^admin/', admin.site.urls),
path('ajax_lookups/', include(ajax_select_urls)),
path('admin/', admin.site.urls),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,19 @@
[tox]
envlist =
{py38}-flake8,
py38-{dj22,dj30,dj31}

py38-{dj22,dj30,dj31,dj32,dj40}
[testenv]
setenv =
DJANGO_SETTINGS_MODULE=tests.settings
PYTHONPATH = {toxinidir}:{toxinidir}/ajax_select:{toxinidir}/tests
commands = django-admin.py test tests
PYTHONWARNINGS = default
commands = django-admin test tests
deps =
dj22: Django>=2.2,<2.3
dj30: Django>=3,<3.1
dj31: Django>=3.1,<3.2
dj32: Django>=3.2,<3.3
dj40: Django>=4,<4.1
; djmaster: https://github.com/django/django/zipball/master

[testenv:py38-flake8]
Expand Down