Skip to content

Commit 937a62d

Browse files
committed
Simplified _get_unique_checks by passing kwargs
1 parent cfc45a9 commit 937a62d

File tree

4 files changed

+5
-19
lines changed

4 files changed

+5
-19
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,13 @@ jobs:
66
strategy:
77
matrix:
88
python-version:
9-
- "3.6"
9+
- "3.8"
1010
- "3.9"
1111
django-version:
1212
- "3.1"
1313
- "3.2"
1414
- "4.0"
1515
- "4.1"
16-
exclude:
17-
- python-version: "3.6"
18-
django-version: "4.0"
19-
- python-version: "3.6"
20-
django-version: "4.1"
2116

2217
steps:
2318
- uses: actions/checkout@v2

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,5 +132,3 @@ class FelineAdmin(TypedModelAdmin):
132132

133133
* Django 3.1+
134134
* Python 3.6+
135-
136-
Django 4.1 is now supported (unique constraints defined on Meta are not tested)

tox.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
[tox]
33
envlist = {py36,py39}-{dj31}
44
{py36,py39}-{dj32}
5-
{py36,py39}-{dj40}
6-
{py36,py39}-{dj41}
5+
{py38,py310}-{dj40}
6+
{py38,py310}-{dj41}
77

88
toxworkdir = {homedir}/.tox-django-typed-models
99

typedmodels/models.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,16 +437,9 @@ def save(self, *args, **kwargs):
437437
raise RuntimeError("Untyped %s cannot be saved." % self.__class__.__name__)
438438
return super(TypedModel, self).save(*args, **kwargs)
439439

440-
def _get_unique_checks(self, exclude=None, include_meta_constraints=False):
441-
unique_check_kwargs = {"exclude": exclude}
442-
parent_unique_checks_args = inspect.getargspec(super(TypedModel, self)._get_unique_checks)
443-
444-
if "include_meta_constraints" in parent_unique_checks_args[0]:
445-
# django 4.0 does not have this argument but django 4.1 does
446-
unique_check_kwargs["include_meta_constraints"] = include_meta_constraints
447-
440+
def _get_unique_checks(self, exclude=None, **kwargs):
448441
unique_checks, date_checks = super(TypedModel, self)._get_unique_checks(
449-
**unique_check_kwargs
442+
exclude=exclude, **kwargs
450443
)
451444

452445
for i, (model_class, field_names) in reversed(list(enumerate(unique_checks))):

0 commit comments

Comments
 (0)