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

Drop support for Django < 4.2 #381

Merged
merged 1 commit into from
Sep 23, 2024
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
23 changes: 6 additions & 17 deletions .github/workflows/python-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -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)
-------------------
Expand Down
5 changes: 0 additions & 5 deletions leaflet/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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'
7 changes: 3 additions & 4 deletions leaflet/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,11 @@ def test_widget_template_overriden(self):
widget = self.formfield.widget
output = widget.render('geom', '', {'id': 'geom'})
self.assertIn('<div id="geom-div-map">', output)
link_type = 'type="text/css" ' if django.get_version() < '4.1' else ''
self.assertEqual(
list(widget.media.render_css()),
[
f'<link href="/static/leaflet/leaflet.css" {link_type}media="screen" rel="stylesheet">',
f'<link href="/static/leaflet/leaflet_django.css" {link_type}media="screen" rel="stylesheet">',
f'<link href="/static/leaflet/draw/leaflet.draw.css" {link_type}media="screen" rel="stylesheet">',
'<link href="/static/leaflet/leaflet.css" media="screen" rel="stylesheet">',
'<link href="/static/leaflet/leaflet_django.css" media="screen" rel="stylesheet">',
'<link href="/static/leaflet/draw/leaflet.draw.css" media="screen" rel="stylesheet">',
]
)
3 changes: 1 addition & 2 deletions quicktest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': [
Expand All @@ -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
Expand Down
10 changes: 3 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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