-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(types): Make admin classes generic as their super classes (#737)
Co-authored-by: Serhii Tereshchenko <[email protected]>
- Loading branch information
1 parent
6768a26
commit d2c16fe
Showing
5 changed files
with
80 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
from modeltranslation._typing import monkeypatch | ||
|
||
try: | ||
from django import VERSION as _django_version | ||
|
||
if _django_version < (3, 2): | ||
default_app_config = "modeltranslation.apps.ModeltranslationConfig" | ||
except ImportError: | ||
pass | ||
|
||
# monkeypatch generic classes at runtime | ||
monkeypatch() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from modeltranslation import admin | ||
from modeltranslation.tests import models | ||
|
||
|
||
def test_translation_admin(): | ||
class TestModelAdmin(admin.TranslationAdmin[models.TestModel]): | ||
pass | ||
|
||
class TestInlineModelAdmin( | ||
admin.TranslationInlineModelAdmin[models.ForeignKeyModel, models.TestModel] | ||
): | ||
pass |