Skip to content

Commit cbc7140

Browse files
committed
Support Django 4.2–5.2 LTS
- setup.py: Change Django range to >=4.2,<5.3. Django 4.2 LTS is supported until April 2026. - cove/input/views.py: Override source_url with an explicit URLField setting assume_scheme="https". Without this, Django 5.x emits RemovedInDjango60Warning because URLField.formfield() no longer supplies a default scheme. - cove/settings.py: Remove USE_L10N (default True since Django 4.0, setting removed in 5.0). - ci.yml: Test Django 4.2 and 5.2 on Python 3.10/3.12/3.13. Enable PYTHONWARNINGS=error for all versions. - cove/management/commands/tests.py: Use datetime.timezone.utc instead of timezone.utc, which was removed in Django 5.0.
1 parent ec269a9 commit cbc7140

5 files changed

Lines changed: 9 additions & 34 deletions

File tree

.github/workflows/ci.yml

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,14 @@ jobs:
66
runs-on: ubuntu-latest
77
strategy:
88
matrix:
9-
python-version: ["3.8", "3.9", "3.10"]
9+
python-version: ["3.10", "3.12", "3.13"]
1010
django-version:
11-
- "Django>=2.2,<2.3"
12-
- "Django>=3.0,<3.1"
13-
- "Django>=3.1,<3.2"
14-
- "Django>=3.2,<3.3"
1511
- "Django>=4.2,<4.3"
12+
- "Django>=5.2,<5.3"
1613
exclude:
17-
# Django 3.1+ supports Python 3.9.
18-
# https://docs.djangoproject.com/en/3.1/releases/3.1.3/
19-
- python-version: "3.9"
20-
django-version: "Django>=2.2,<2.3"
21-
- python-version: "3.9"
22-
django-version: "Django>=3.0,<3.1"
23-
# Django 3.2+ supports Python 3.10.
24-
# https://docs.djangoproject.com/en/3.2/releases/3.2/
25-
- python-version: "3.10"
26-
django-version: "Django>=2.2,<2.3"
27-
- python-version: "3.10"
28-
django-version: "Django>=3.0,<3.1"
29-
- python-version: "3.10"
30-
django-version: "Django>=3.1,<3.2"
14+
# Django 4.2 supports Python 3.8–3.12.
15+
- python-version: "3.13"
16+
django-version: "Django>=4.2,<4.3"
3117
steps:
3218
- uses: actions/checkout@v4
3319
- name: Setup python
@@ -43,14 +29,6 @@ jobs:
4329
PYTHONWARNINGS: error
4430
DJANGO_SETTINGS_MODULE: cove.settings
4531
SECRET_KEY: 7ur)dt+e%1^e6$8_sd-@1h67_5zixe2&39%r2$$8_7v6fr_7ee
46-
if: ${{ matrix.django-version != 'Django>=4.2,<4.3' }}
47-
# Don't set PYTHONWARNING for Django 4.2, as that has some known
48-
# deprecation warnings for 5.0
49-
- run: "py.test -n 2 cove --cov"
50-
env:
51-
DJANGO_SETTINGS_MODULE: cove.settings
52-
SECRET_KEY: 7ur)dt+e%1^e6$8_sd-@1h67_5zixe2&39%r2$$8_7v6fr_7ee
53-
if: ${{ matrix.django-version == 'Django>=4.2,<4.3' }}
5432
- name: Check existing migrations can run and no migrations are missing
5533
env:
5634
DJANGO_SETTINGS_MODULE: cove.settings

cove/input/views.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,11 @@ class Meta:
2121

2222

2323
class UrlForm(forms.ModelForm):
24+
source_url = forms.URLField(label=_('Supply a URL'), assume_scheme="https", max_length=2000)
25+
2426
class Meta:
2527
model = SuppliedData
2628
fields = ['source_url']
27-
labels = {
28-
'source_url': _('Supply a URL')
29-
}
3029

3130

3231
class TextForm(forms.Form):

cove/management/commands/tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_expire_files():
1313
recent.original_file.save('test.json', ContentFile('{}'))
1414

1515
old = SuppliedData.objects.create()
16-
old.created = timezone.datetime(2015, 1, 1, tzinfo=timezone.utc)
16+
old.created = timezone.datetime(2015, 1, 1, tzinfo=datetime.timezone.utc)
1717
old.original_file.save('test.json', ContentFile('{}'))
1818

1919
call_command('expire_files')

cove/settings.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@
126126

127127
USE_I18N = True
128128

129-
USE_L10N = True
130-
131129
USE_TZ = True
132130

133131

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
classifiers=["License :: OSI Approved :: BSD License"],
2929
python_requires=">=3.8",
3030
install_requires=[
31-
"Django>=2.2,<4.3",
31+
"Django>=4.2,<5.3",
3232
"django-bootstrap3",
3333
"requests",
3434
"flattentool",

0 commit comments

Comments
 (0)