From 347f9021ae25e071bacb2166d592a7190086ca1a Mon Sep 17 00:00:00 2001 From: Claude Paroz Date: Mon, 23 Sep 2024 09:39:38 +0200 Subject: [PATCH] Drop support for Django < 4.2 (#381) --- .github/workflows/python-app.yml | 23 ++++++----------------- CHANGES | 4 +++- leaflet/__init__.py | 5 ----- leaflet/tests/tests.py | 7 +++---- quicktest.py | 3 +-- tox.ini | 10 +++------- 6 files changed, 16 insertions(+), 36 deletions(-) diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 1556b707..fc3ae279 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -16,11 +16,9 @@ jobs: strategy: matrix: django_version: - - '3.2' - - '4.0' - - '4.1' - '4.2' - '5.0' + - '5.1' python_version: - '3.8' - '3.9' @@ -35,23 +33,14 @@ jobs: - django_version: '5.0' python_version: '3.9' - - django_version: '3.2' - python_version: '3.11' - - - django_version: '4.0' - python_version: '3.11' - - - django_version: '3.2' - python_version: '3.12' - - - django_version: '4.0' - python_version: '3.12' + - django_version: '5.1' + python_version: '3.8' - - django_version: '4.1' - python_version: '3.12' + - django_version: '5.1' + python_version: '3.9' include: - - django_version: '3.2' + - django_version: '4.2' python_version: '3.8' database: 'sqlite' env: diff --git a/CHANGES b/CHANGES index 5059e69a..4b342944 100644 --- a/CHANGES +++ b/CHANGES @@ -2,11 +2,13 @@ CHANGELOG ========= -0.30.2 (unreleased) +0.31.0 (unreleased) ------------------- - Fix icon control. - Fix JS error if with-forms does not exists #379 #380 +- Support Django 5.1. +- Drop support for Django < 4.2. 0.30.1 (2024-06-17) ------------------- diff --git a/leaflet/__init__.py b/leaflet/__init__.py index 87e517cf..d1f2f303 100644 --- a/leaflet/__init__.py +++ b/leaflet/__init__.py @@ -1,7 +1,6 @@ from collections import OrderedDict from urllib.parse import urlparse -import django from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.templatetags.static import static @@ -174,7 +173,3 @@ def _normalize_plugins_config(): PLUGINS[PLUGIN_ALL].setdefault(resource_type, []).extend(urls) PLUGINS['__is_normalized__'] = True - - -if django.VERSION < (3, 2): - default_app_config = 'leaflet.apps.LeafletConfig' diff --git a/leaflet/tests/tests.py b/leaflet/tests/tests.py index c231942a..e586101b 100644 --- a/leaflet/tests/tests.py +++ b/leaflet/tests/tests.py @@ -309,12 +309,11 @@ def test_widget_template_overriden(self): widget = self.formfield.widget output = widget.render('geom', '', {'id': 'geom'}) self.assertIn('
', output) - link_type = 'type="text/css" ' if django.get_version() < '4.1' else '' self.assertEqual( list(widget.media.render_css()), [ - f'', - f'', - f'', + '', + '', + '', ] ) diff --git a/quicktest.py b/quicktest.py index 652c70ee..01e0a20f 100644 --- a/quicktest.py +++ b/quicktest.py @@ -57,6 +57,7 @@ def run_tests(self): } conf = { 'DATABASES': databases, + 'DEFAULT_AUTO_FIELD': 'django.db.models.BigAutoField', 'INSTALLED_APPS': self.INSTALLED_APPS + self.apps, 'STATIC_URL': '/static/', 'MIDDLEWARE': [ @@ -77,8 +78,6 @@ def run_tests(self): 'APP_DIRS': True, }], } - if django.VERSION >= (3, 2): - conf["DEFAULT_AUTO_FIELD"] = "django.db.models.BigAutoField" if 'SPATIALITE_LIBRARY_PATH' in os.environ: # If you get SpatiaLite-related errors, refer to this document # to find out the proper SPATIALITE_LIBRARY_PATH value diff --git a/tox.ini b/tox.ini index 38d71dfb..c36acc12 100644 --- a/tox.ini +++ b/tox.ini @@ -1,22 +1,18 @@ [tox] envlist = - {py38,py39,py310}-django32 - {py38,py39,py310}-django40 - {py38,py39,py310,py311}-django41 {py38,py39,py310,py311,py312}-django42 {py310,py311,py312}-django50 + {py310,py311,py312}-django51 {py310,py311,py312}-djangomain [testenv] commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m coverage run ./quicktest.py leaflet --db={env:DATABASE:} deps = - django32: Django~=3.2 - django40: Django~=4.0 - django41: Django~=4.1 django42: Django~=4.2 django50: Django~=5.0 + django51: Django~=5.1 djangomain: https://github.com/django/django/archive/main.tar.gz - postgres: psycopg2-binary + postgres: psycopg coverage passenv = DATABASE,SPATIALITE_LIBRARY_PATH