Skip to content

Commit 347f902

Browse files
authored
Drop support for Django < 4.2 (#381)
1 parent b818841 commit 347f902

File tree

6 files changed

+16
-36
lines changed

6 files changed

+16
-36
lines changed

.github/workflows/python-app.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ jobs:
1616
strategy:
1717
matrix:
1818
django_version:
19-
- '3.2'
20-
- '4.0'
21-
- '4.1'
2219
- '4.2'
2320
- '5.0'
21+
- '5.1'
2422
python_version:
2523
- '3.8'
2624
- '3.9'
@@ -35,23 +33,14 @@ jobs:
3533
- django_version: '5.0'
3634
python_version: '3.9'
3735

38-
- django_version: '3.2'
39-
python_version: '3.11'
40-
41-
- django_version: '4.0'
42-
python_version: '3.11'
43-
44-
- django_version: '3.2'
45-
python_version: '3.12'
46-
47-
- django_version: '4.0'
48-
python_version: '3.12'
36+
- django_version: '5.1'
37+
python_version: '3.8'
4938

50-
- django_version: '4.1'
51-
python_version: '3.12'
39+
- django_version: '5.1'
40+
python_version: '3.9'
5241

5342
include:
54-
- django_version: '3.2'
43+
- django_version: '4.2'
5544
python_version: '3.8'
5645
database: 'sqlite'
5746
env:

CHANGES

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
CHANGELOG
33
=========
44

5-
0.30.2 (unreleased)
5+
0.31.0 (unreleased)
66
-------------------
77

88
- Fix icon control.
99
- Fix JS error if with-forms does not exists #379 #380
10+
- Support Django 5.1.
11+
- Drop support for Django < 4.2.
1012

1113
0.30.1 (2024-06-17)
1214
-------------------

leaflet/__init__.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from collections import OrderedDict
22
from urllib.parse import urlparse
33

4-
import django
54
from django.conf import settings
65
from django.core.exceptions import ImproperlyConfigured
76
from django.templatetags.static import static
@@ -174,7 +173,3 @@ def _normalize_plugins_config():
174173
PLUGINS[PLUGIN_ALL].setdefault(resource_type, []).extend(urls)
175174

176175
PLUGINS['__is_normalized__'] = True
177-
178-
179-
if django.VERSION < (3, 2):
180-
default_app_config = 'leaflet.apps.LeafletConfig'

leaflet/tests/tests.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,12 +309,11 @@ def test_widget_template_overriden(self):
309309
widget = self.formfield.widget
310310
output = widget.render('geom', '', {'id': 'geom'})
311311
self.assertIn('<div id="geom-div-map">', output)
312-
link_type = 'type="text/css" ' if django.get_version() < '4.1' else ''
313312
self.assertEqual(
314313
list(widget.media.render_css()),
315314
[
316-
f'<link href="/static/leaflet/leaflet.css" {link_type}media="screen" rel="stylesheet">',
317-
f'<link href="/static/leaflet/leaflet_django.css" {link_type}media="screen" rel="stylesheet">',
318-
f'<link href="/static/leaflet/draw/leaflet.draw.css" {link_type}media="screen" rel="stylesheet">',
315+
'<link href="/static/leaflet/leaflet.css" media="screen" rel="stylesheet">',
316+
'<link href="/static/leaflet/leaflet_django.css" media="screen" rel="stylesheet">',
317+
'<link href="/static/leaflet/draw/leaflet.draw.css" media="screen" rel="stylesheet">',
319318
]
320319
)

quicktest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def run_tests(self):
5757
}
5858
conf = {
5959
'DATABASES': databases,
60+
'DEFAULT_AUTO_FIELD': 'django.db.models.BigAutoField',
6061
'INSTALLED_APPS': self.INSTALLED_APPS + self.apps,
6162
'STATIC_URL': '/static/',
6263
'MIDDLEWARE': [
@@ -77,8 +78,6 @@ def run_tests(self):
7778
'APP_DIRS': True,
7879
}],
7980
}
80-
if django.VERSION >= (3, 2):
81-
conf["DEFAULT_AUTO_FIELD"] = "django.db.models.BigAutoField"
8281
if 'SPATIALITE_LIBRARY_PATH' in os.environ:
8382
# If you get SpatiaLite-related errors, refer to this document
8483
# to find out the proper SPATIALITE_LIBRARY_PATH value

tox.ini

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
11
[tox]
22
envlist =
3-
{py38,py39,py310}-django32
4-
{py38,py39,py310}-django40
5-
{py38,py39,py310,py311}-django41
63
{py38,py39,py310,py311,py312}-django42
74
{py310,py311,py312}-django50
5+
{py310,py311,py312}-django51
86
{py310,py311,py312}-djangomain
97

108
[testenv]
119
commands = python -W error::DeprecationWarning -W error::PendingDeprecationWarning -m coverage run ./quicktest.py leaflet --db={env:DATABASE:}
1210
deps =
13-
django32: Django~=3.2
14-
django40: Django~=4.0
15-
django41: Django~=4.1
1611
django42: Django~=4.2
1712
django50: Django~=5.0
13+
django51: Django~=5.1
1814
djangomain: https://github.com/django/django/archive/main.tar.gz
19-
postgres: psycopg2-binary
15+
postgres: psycopg
2016
coverage
2117
passenv = DATABASE,SPATIALITE_LIBRARY_PATH
2218

0 commit comments

Comments
 (0)