Skip to content

Commit

Permalink
Dropped support for Django 3.2
Browse files Browse the repository at this point in the history
Its EOL was passed last month (April 1st); see
https://www.djangoproject.com/download/#supported-versions.
  • Loading branch information
ddabble committed May 15, 2024
1 parent af81e4f commit b9fc885
Show file tree
Hide file tree
Showing 11 changed files with 17 additions and 63 deletions.
10 changes: 1 addition & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13-dev']
django-version: ['3.2', '4.2', '5.0', 'main']
django-version: ['4.2', '5.0', 'main']

exclude:
# Exclude py3.8 and py3.9 for Django main and 5.0
Expand All @@ -25,14 +25,6 @@ jobs:
- python-version: '3.9'
django-version: 'main'

# Exclude py3.11, py3.12 and py3.13 for Django 3.2
- python-version: '3.11'
django-version: '3.2'
- python-version: '3.12'
django-version: '3.2'
- python-version: '3.13-dev'
django-version: '3.2'

services:

postgres:
Expand Down
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Unreleased
- For history-tracked M2M fields, adding M2M objects (using ``add()`` or ``set()``)
used to cause a number of database queries that scaled linearly with the number of
objects; this has been fixed to now be a constant number of queries (gh-1333)
- Dropped support for Django 3.2, which reached end-of-life on 2024-04-01 (gh-1344)
- Removed the temporary requirement on ``asgiref>=3.6`` added in 3.5.0,
now that the minimum required Django version is 4.2 (gh-1344)

3.5.0 (2024-02-19)
------------------
Expand Down
1 change: 0 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python:
========== ========================
Django Python
========== ========================
3.2 3.8, 3.9, 3.10
4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev
5.0 3.10, 3.11, 3.12, 3.13-dev
main 3.10, 3.11, 3.12, 3.13-dev
Expand Down
1 change: 0 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ This app supports the following combinations of Django and Python:
========== =======================
Django Python
========== =======================
3.2 3.8, 3.9, 3.10
4.2 3.8, 3.9, 3.10, 3.11, 3.12, 3.13-dev
5.0 3.10, 3.11, 3.12, 3.13-dev
main 3.10, 3.11, 3.12, 3.13-dev
Expand Down
5 changes: 1 addition & 4 deletions requirements/postgres.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
# DEV: Replace this with `psycopg[binary]` when the minimum required Django version is
# 4.2 or higher, as this is likely to be deprecated in the future
# (see https://docs.djangoproject.com/en/4.2/releases/4.2/#psycopg-3-support)
psycopg2-binary==2.9.9
psycopg[binary]==3.1.19
2 changes: 0 additions & 2 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
-r ./coverage.txt
# DEV: Remove this requirement entirely when the minimum required Django version is 4.2
asgiref>=3.6
16 changes: 6 additions & 10 deletions runtests.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ def __getitem__(self, item):
},
}
],
STORAGES={
"default": {
# Speeds up tests and prevents locally storing files created through them
"BACKEND": "django.core.files.storage.InMemoryStorage",
},
},
DEFAULT_AUTO_FIELD="django.db.models.AutoField",
USE_TZ=False,
)
Expand All @@ -146,16 +152,6 @@ def __getitem__(self, item):

DEFAULT_SETTINGS["MIDDLEWARE"] = MIDDLEWARE

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


def get_default_settings(*, database_name=DEFAULT_DATABASE_NAME):
return {
Expand Down
4 changes: 1 addition & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
"fallback_version": "0.0.0",
},
setup_requires=["setuptools_scm"],
# DEV: Remove `asgiref` when the minimum required Django version is 4.2
install_requires=["asgiref>=3.6"],
install_requires=[],
description="Store model history and view/revert changes from admin site.",
long_description="\n".join((readme.read(), changes.read())),
long_description_content_type="text/x-rst",
Expand All @@ -38,7 +37,6 @@
"Environment :: Web Environment",
"Intended Audience :: Developers",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.0",
"Programming Language :: Python",
Expand Down
20 changes: 5 additions & 15 deletions simple_history/tests/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,7 @@ def test_history_form_view_without_getting_history(self):
context = {
**admin_site.each_context(request),
# Verify this is set for original object
"log_entries": ANY,
"original": poll,
"change_history": False,
"title": "Revert %s" % force_str(poll),
Expand Down Expand Up @@ -650,9 +651,6 @@ def test_history_form_view_without_getting_history(self):
"save_on_top": admin.save_on_top,
"root_path": getattr(admin_site, "root_path", None),
}
# This key didn't exist prior to Django 4.2
if "log_entries" in context:
context["log_entries"] = ANY

mock_render.assert_called_once_with(
request, admin.object_history_form_template, context
Expand Down Expand Up @@ -680,6 +678,7 @@ def test_history_form_view_getting_history(self):
context = {
**admin_site.each_context(request),
# Verify this is set for history object not poll object
"log_entries": ANY,
"original": history.instance,
"change_history": True,
"title": "Revert %s" % force_str(history.instance),
Expand Down Expand Up @@ -709,9 +708,6 @@ def test_history_form_view_getting_history(self):
"save_on_top": admin.save_on_top,
"root_path": getattr(admin_site, "root_path", None),
}
# This key didn't exist prior to Django 4.2
if "log_entries" in context:
context["log_entries"] = ANY

mock_render.assert_called_once_with(
request, admin.object_history_form_template, context
Expand Down Expand Up @@ -739,6 +735,7 @@ def test_history_form_view_getting_history_with_setting_off(self):
context = {
**admin_site.each_context(request),
# Verify this is set for history object not poll object
"log_entries": ANY,
"original": poll,
"change_history": False,
"title": "Revert %s" % force_str(poll),
Expand Down Expand Up @@ -768,9 +765,6 @@ def test_history_form_view_getting_history_with_setting_off(self):
"save_on_top": admin.save_on_top,
"root_path": getattr(admin_site, "root_path", None),
}
# This key didn't exist prior to Django 4.2
if "log_entries" in context:
context["log_entries"] = ANY

mock_render.assert_called_once_with(
request, admin.object_history_form_template, context
Expand Down Expand Up @@ -798,6 +792,7 @@ def test_history_form_view_getting_history_abstract_external(self):
context = {
**admin_site.each_context(request),
# Verify this is set for history object
"log_entries": ANY,
"original": history.instance,
"change_history": True,
"title": "Revert %s" % force_str(history.instance),
Expand Down Expand Up @@ -829,9 +824,6 @@ def test_history_form_view_getting_history_abstract_external(self):
"save_on_top": admin.save_on_top,
"root_path": getattr(admin_site, "root_path", None),
}
# This key didn't exist prior to Django 4.2
if "log_entries" in context:
context["log_entries"] = ANY

mock_render.assert_called_once_with(
request, admin.object_history_form_template, context
Expand Down Expand Up @@ -862,6 +854,7 @@ def test_history_form_view_accepts_additional_context(self):
context = {
**admin_site.each_context(request),
# Verify this is set for original object
"log_entries": ANY,
"anything_else": "will be merged into context",
"original": poll,
"change_history": False,
Expand Down Expand Up @@ -892,9 +885,6 @@ def test_history_form_view_accepts_additional_context(self):
"save_on_top": admin.save_on_top,
"root_path": getattr(admin_site, "root_path", None),
}
# This key didn't exist prior to Django 4.2
if "log_entries" in context:
context["log_entries"] = ANY

mock_render.assert_called_once_with(
request, admin.object_history_form_template, context
Expand Down
15 changes: 0 additions & 15 deletions simple_history/tests/tests/test_manager.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import datetime, timedelta
from operator import attrgetter

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

# DEV: Remove this method when the minimum required Django version is 4.2
def assertQuerySetEqual(self, *args, **kwargs):
if django.VERSION < (4, 2):
return self.assertQuerysetEqual(*args, **kwargs)
else:
return super().assertQuerySetEqual(*args, **kwargs)

def test_simple_bulk_history_create(self):
created = Poll.history.bulk_history_create(self.data)
self.assertEqual(len(created), 4)
Expand Down Expand Up @@ -334,13 +326,6 @@ def setUp(self):
Poll(id=4, question="Question 4", pub_date=datetime.now()),
]

# DEV: Remove this method when the minimum required Django version is 4.2
def assertQuerySetEqual(self, *args, **kwargs):
if django.VERSION < (4, 2):
return self.assertQuerysetEqual(*args, **kwargs)
else:
return super().assertQuerySetEqual(*args, **kwargs)

def test_simple_bulk_history_create(self):
created = Poll.history.bulk_history_create(self.data, update=True)
self.assertEqual(len(created), 4)
Expand Down
3 changes: 0 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
[tox]
envlist =
py{38,39,310}-dj32-{sqlite3,postgres,mysql,mariadb},
py{38,39,310,311,312}-dj42-{sqlite3,postgres,mysql,mariadb},
py{310,311,312}-dj50-{sqlite3,postgres,mysql,mariadb},
py{310,311,312}-djmain-{sqlite3,postgres,mysql,mariadb},
Expand All @@ -21,7 +20,6 @@ python =

[gh-actions:env]
DJANGO =
3.2: dj32
4.2: dj42
5.0: dj50
main: djmain
Expand All @@ -35,7 +33,6 @@ exclude = __init__.py,simple_history/registry_tests/migration_test_app/migration
[testenv]
deps =
-rrequirements/test.txt
dj32: Django>=3.2,<3.3
dj42: Django>=4.2,<4.3
dj50: Django>=5.0,<5.1
djmain: https://github.com/django/django/tarball/main
Expand Down

0 comments on commit b9fc885

Please sign in to comment.