Skip to content

Commit 560f298

Browse files
authored
Dropped support for Django 3.2 (#1344)
Its EOL was passed last month (April 1st); see https://www.djangoproject.com/download/#supported-versions. The changes in `test_admin.py` were made to slightly reduce the amount of work required when dropping support for Django 4.2 in the future (also the previous comments contained a typo, and should have said "prior to Django 5.0" instead of "prior to Django 4.2").
1 parent 3854269 commit 560f298

File tree

11 files changed

+34
-64
lines changed

11 files changed

+34
-64
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev']
15-
django-version: ['3.2', '4.2', '5.0', 'main']
15+
django-version: ['4.2', '5.0', 'main']
1616

1717
exclude:
1818
# Exclude py3.8 and py3.9 for Django main and 5.0
@@ -25,14 +25,6 @@ jobs:
2525
- python-version: '3.9'
2626
django-version: 'main'
2727

28-
# Exclude py3.11, py3.12 and py3.13 for Django 3.2
29-
- python-version: '3.11'
30-
django-version: '3.2'
31-
- python-version: '3.12'
32-
django-version: '3.2'
33-
- python-version: '3.13-dev'
34-
django-version: '3.2'
35-
3628
services:
3729

3830
postgres:

CHANGES.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Changes
44
Unreleased
55
----------
66

7+
- Dropped support for Django 3.2, which reached end-of-life on 2024-04-01 (gh-1344)
8+
- Removed the temporary requirement on ``asgiref>=3.6`` added in 3.5.0,
9+
now that the minimum required Django version is 4.2 (gh-1344)
710

811
3.6.0 (2024-05-26)
912
------------------

README.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python:
4141
========== ========================
4242
Django Python
4343
========== ========================
44-
3.2 3.8, 3.9, 3.10
4544
4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev
4645
5.0 3.10, 3.11, 3.12, 3.13-dev
4746
main 3.10, 3.11, 3.12, 3.13-dev

docs/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python:
4141
========== =======================
4242
Django Python
4343
========== =======================
44-
3.2 3.8, 3.9, 3.10
4544
4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev
4645
5.0 3.10, 3.11, 3.12, 3.13-dev
4746
main 3.10, 3.11, 3.12, 3.13-dev

requirements/postgres.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
# DEV: Replace this with `psycopg[binary]` when the minimum required Django version is
2-
# 4.2 or higher, as this is likely to be deprecated in the future
3-
# (see https://docs.djangoproject.com/en/4.2/releases/4.2/#psycopg-3-support)
4-
psycopg2-binary==2.9.9
1+
psycopg[binary]==3.1.19

requirements/test.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
11
-r ./coverage.txt
2-
# DEV: Remove this requirement entirely when the minimum required Django version is 4.2
3-
asgiref>=3.6

runtests.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ def __getitem__(self, item):
135135
},
136136
}
137137
],
138+
STORAGES={
139+
"default": {
140+
# Speeds up tests and prevents locally storing files created through them
141+
"BACKEND": "django.core.files.storage.InMemoryStorage",
142+
},
143+
},
138144
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
139145
USE_TZ=False,
140146
)
@@ -146,16 +152,6 @@ def __getitem__(self, item):
146152

147153
DEFAULT_SETTINGS["MIDDLEWARE"] = MIDDLEWARE
148154

149-
# DEV: Merge these settings into DEFAULT_SETTINGS when the minimum required
150-
# Django version is 4.2 or higher
151-
if django.VERSION >= (4, 2):
152-
DEFAULT_SETTINGS["STORAGES"] = {
153-
"default": {
154-
# Speeds up tests and prevents locally storing files created through them
155-
"BACKEND": "django.core.files.storage.InMemoryStorage",
156-
},
157-
}
158-
159155

160156
def get_default_settings(*, database_name=DEFAULT_DATABASE_NAME):
161157
return {

setup.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"fallback_version": "0.0.0",
1212
},
1313
setup_requires=["setuptools_scm"],
14-
# DEV: Remove `asgiref` when the minimum required Django version is 4.2
15-
install_requires=["asgiref>=3.6"],
14+
install_requires=[],
1615
description="Store model history and view/revert changes from admin site.",
1716
long_description="\n".join((readme.read(), changes.read())),
1817
long_description_content_type="text/x-rst",
@@ -38,7 +37,6 @@
3837
"Environment :: Web Environment",
3938
"Intended Audience :: Developers",
4039
"Framework :: Django",
41-
"Framework :: Django :: 3.2",
4240
"Framework :: Django :: 4.2",
4341
"Framework :: Django :: 5.0",
4442
"Programming Language :: Python",

simple_history/tests/tests/test_admin.py

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import datetime, timedelta
22
from unittest.mock import ANY, patch
33

4+
import django
45
from django.contrib.admin import AdminSite
56
from django.contrib.admin.utils import quote
67
from django.contrib.auth import get_user_model
@@ -621,6 +622,7 @@ def test_history_form_view_without_getting_history(self):
621622
context = {
622623
**admin_site.each_context(request),
623624
# Verify this is set for original object
625+
"log_entries": ANY,
624626
"original": poll,
625627
"change_history": False,
626628
"title": "Revert %s" % force_str(poll),
@@ -650,9 +652,9 @@ def test_history_form_view_without_getting_history(self):
650652
"save_on_top": admin.save_on_top,
651653
"root_path": getattr(admin_site, "root_path", None),
652654
}
653-
# This key didn't exist prior to Django 4.2
654-
if "log_entries" in context:
655-
context["log_entries"] = ANY
655+
# DEV: Remove this when support for Django 4.2 has been dropped
656+
if django.VERSION < (5, 0):
657+
del context["log_entries"]
656658

657659
mock_render.assert_called_once_with(
658660
request, admin.object_history_form_template, context
@@ -680,6 +682,7 @@ def test_history_form_view_getting_history(self):
680682
context = {
681683
**admin_site.each_context(request),
682684
# Verify this is set for history object not poll object
685+
"log_entries": ANY,
683686
"original": history.instance,
684687
"change_history": True,
685688
"title": "Revert %s" % force_str(history.instance),
@@ -709,9 +712,9 @@ def test_history_form_view_getting_history(self):
709712
"save_on_top": admin.save_on_top,
710713
"root_path": getattr(admin_site, "root_path", None),
711714
}
712-
# This key didn't exist prior to Django 4.2
713-
if "log_entries" in context:
714-
context["log_entries"] = ANY
715+
# DEV: Remove this when support for Django 4.2 has been dropped
716+
if django.VERSION < (5, 0):
717+
del context["log_entries"]
715718

716719
mock_render.assert_called_once_with(
717720
request, admin.object_history_form_template, context
@@ -739,6 +742,7 @@ def test_history_form_view_getting_history_with_setting_off(self):
739742
context = {
740743
**admin_site.each_context(request),
741744
# Verify this is set for history object not poll object
745+
"log_entries": ANY,
742746
"original": poll,
743747
"change_history": False,
744748
"title": "Revert %s" % force_str(poll),
@@ -768,9 +772,9 @@ def test_history_form_view_getting_history_with_setting_off(self):
768772
"save_on_top": admin.save_on_top,
769773
"root_path": getattr(admin_site, "root_path", None),
770774
}
771-
# This key didn't exist prior to Django 4.2
772-
if "log_entries" in context:
773-
context["log_entries"] = ANY
775+
# DEV: Remove this when support for Django 4.2 has been dropped
776+
if django.VERSION < (5, 0):
777+
del context["log_entries"]
774778

775779
mock_render.assert_called_once_with(
776780
request, admin.object_history_form_template, context
@@ -798,6 +802,7 @@ def test_history_form_view_getting_history_abstract_external(self):
798802
context = {
799803
**admin_site.each_context(request),
800804
# Verify this is set for history object
805+
"log_entries": ANY,
801806
"original": history.instance,
802807
"change_history": True,
803808
"title": "Revert %s" % force_str(history.instance),
@@ -829,9 +834,9 @@ def test_history_form_view_getting_history_abstract_external(self):
829834
"save_on_top": admin.save_on_top,
830835
"root_path": getattr(admin_site, "root_path", None),
831836
}
832-
# This key didn't exist prior to Django 4.2
833-
if "log_entries" in context:
834-
context["log_entries"] = ANY
837+
# DEV: Remove this when support for Django 4.2 has been dropped
838+
if django.VERSION < (5, 0):
839+
del context["log_entries"]
835840

836841
mock_render.assert_called_once_with(
837842
request, admin.object_history_form_template, context
@@ -862,6 +867,7 @@ def test_history_form_view_accepts_additional_context(self):
862867
context = {
863868
**admin_site.each_context(request),
864869
# Verify this is set for original object
870+
"log_entries": ANY,
865871
"anything_else": "will be merged into context",
866872
"original": poll,
867873
"change_history": False,
@@ -892,9 +898,9 @@ def test_history_form_view_accepts_additional_context(self):
892898
"save_on_top": admin.save_on_top,
893899
"root_path": getattr(admin_site, "root_path", None),
894900
}
895-
# This key didn't exist prior to Django 4.2
896-
if "log_entries" in context:
897-
context["log_entries"] = ANY
901+
# DEV: Remove this when support for Django 4.2 has been dropped
902+
if django.VERSION < (5, 0):
903+
del context["log_entries"]
898904

899905
mock_render.assert_called_once_with(
900906
request, admin.object_history_form_template, context

simple_history/tests/tests/test_manager.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from datetime import datetime, timedelta
22
from operator import attrgetter
33

4-
import django
54
from django.contrib.auth import get_user_model
65
from django.db import IntegrityError
76
from django.test import TestCase, override_settings, skipUnlessDBFeature
@@ -199,13 +198,6 @@ def setUp(self):
199198
Poll(id=4, question="Question 4", pub_date=datetime.now()),
200199
]
201200

202-
# DEV: Remove this method when the minimum required Django version is 4.2
203-
def assertQuerySetEqual(self, *args, **kwargs):
204-
if django.VERSION < (4, 2):
205-
return self.assertQuerysetEqual(*args, **kwargs)
206-
else:
207-
return super().assertQuerySetEqual(*args, **kwargs)
208-
209201
def test_simple_bulk_history_create(self):
210202
created = Poll.history.bulk_history_create(self.data)
211203
self.assertEqual(len(created), 4)
@@ -334,13 +326,6 @@ def setUp(self):
334326
Poll(id=4, question="Question 4", pub_date=datetime.now()),
335327
]
336328

337-
# DEV: Remove this method when the minimum required Django version is 4.2
338-
def assertQuerySetEqual(self, *args, **kwargs):
339-
if django.VERSION < (4, 2):
340-
return self.assertQuerysetEqual(*args, **kwargs)
341-
else:
342-
return super().assertQuerySetEqual(*args, **kwargs)
343-
344329
def test_simple_bulk_history_create(self):
345330
created = Poll.history.bulk_history_create(self.data, update=True)
346331
self.assertEqual(len(created), 4)

0 commit comments

Comments
 (0)