-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compat): Use
ForeignObjectRel.hidden
field from django 5.1
Refs #719
- Loading branch information
1 parent
9ce87ee
commit d488f74
Showing
3 changed files
with
23 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
import django | ||
|
||
if TYPE_CHECKING: | ||
from django.db.models.fields.reverse_related import ForeignObjectRel | ||
|
||
|
||
def is_hidden(field: ForeignObjectRel) -> bool: | ||
return field.hidden | ||
|
||
|
||
if django.VERSION <= (5, 1): | ||
|
||
def is_hidden(field: ForeignObjectRel) -> bool: | ||
return field.is_hidden() |
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