-
Notifications
You must be signed in to change notification settings - Fork 493
Drop support for Python 3.8, added support for Django 5.1 #1421
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ maintainers = [ | |
authors = [ | ||
{ name = "Corey Bertram", email = "[email protected]" }, | ||
] | ||
requires-python = ">=3.8" | ||
requires-python = ">=3.9" | ||
classifiers = [ | ||
"Development Status :: 5 - Production/Stable", | ||
"Environment :: Web Environment", | ||
|
@@ -26,13 +26,11 @@ classifiers = [ | |
"License :: OSI Approved :: BSD License", | ||
"Programming Language :: Python", | ||
"Programming Language :: Python :: 3 :: Only", | ||
"Programming Language :: Python :: 3.8", | ||
"Programming Language :: Python :: 3.9", | ||
"Programming Language :: Python :: 3.10", | ||
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
# DEV: uncomment this when the `pyproject-fmt` pre-commit hook stops removing it | ||
#"Programming Language :: Python :: 3.13", | ||
"Programming Language :: Python :: 3.13", | ||
] | ||
dynamic = [ | ||
"readme", | ||
|
@@ -83,12 +81,12 @@ fragments = [ | |
[tool.black] | ||
line-length = 88 | ||
target-version = [ | ||
"py38", | ||
"py39", | ||
] | ||
|
||
[tool.isort] | ||
profile = "black" | ||
py_version = "38" | ||
py_version = "39" | ||
|
||
[tool.coverage.run] | ||
parallel = true | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,9 +2,10 @@ | |
import importlib | ||
import uuid | ||
import warnings | ||
from collections.abc import Iterable, Sequence | ||
from dataclasses import dataclass | ||
from functools import partial | ||
from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Sequence, Type, Union | ||
from typing import TYPE_CHECKING, Any, Union | ||
|
||
import django | ||
from django.apps import apps | ||
|
@@ -899,10 +900,14 @@ def related_manager_cls(self): | |
|
||
class HistoricRelationModelManager(related_model._default_manager.__class__): | ||
def get_queryset(self): | ||
cache_name = ( | ||
# DEV: Remove this when support for Django 5.0 has been dropped | ||
self.field.remote_field.get_cache_name() | ||
if django.VERSION < (5, 1) | ||
else self.field.remote_field.cache_name | ||
) | ||
try: | ||
return self.instance._prefetched_objects_cache[ | ||
self.field.remote_field.get_cache_name() | ||
] | ||
return self.instance._prefetched_objects_cache[cache_name] | ||
Comment on lines
+903
to
+910
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like the Also, the tests didn't fail because of the |
||
except (AttributeError, KeyError): | ||
history = getattr( | ||
self.instance, SIMPLE_HISTORY_REVERSE_ATTR_NAME, None | ||
|
@@ -1088,7 +1093,7 @@ def _get_field_changes_for_diff( | |
old_history: "HistoricalChanges", | ||
fields: Iterable[str], | ||
foreign_keys_are_objs: bool, | ||
) -> List["ModelChange"]: | ||
) -> list["ModelChange"]: | ||
"""Helper method for ``diff_against()``.""" | ||
changes = [] | ||
|
||
|
@@ -1129,7 +1134,7 @@ def _get_m2m_field_changes_for_diff( | |
old_history: "HistoricalChanges", | ||
m2m_fields: Iterable[str], | ||
foreign_keys_are_objs: bool, | ||
) -> List["ModelChange"]: | ||
) -> list["ModelChange"]: | ||
"""Helper method for ``diff_against()``.""" | ||
changes = [] | ||
|
||
|
@@ -1198,7 +1203,7 @@ def get_value(obj, through_field): | |
|
||
@dataclass(frozen=True) | ||
class DeletedObject: | ||
model: Type[models.Model] | ||
model: type[models.Model] | ||
pk: Any | ||
|
||
def __str__(self): | ||
|
@@ -1223,7 +1228,7 @@ def __str__(self): | |
# The PK of the through model's related objects. | ||
# | ||
# - Any of the other possible values of a model field. | ||
ModelChangeValue = Union[Any, DeletedObject, List[Dict[str, Union[Any, DeletedObject]]]] | ||
ModelChangeValue = Union[Any, DeletedObject, list[dict[str, Union[Any, DeletedObject]]]] | ||
|
||
|
||
@dataclass(frozen=True) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks :)