Skip to content

Commit

Permalink
Forward generic type to alias for _DisplayT
Browse files Browse the repository at this point in the history
  • Loading branch information
dephiros committed Dec 12, 2023
1 parent dbff96a commit d8d5467
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions django-stubs/contrib/admin/options.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class BaseModelAdmin(Generic[_ModelT]):
def get_readonly_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> _ListOrTuple[str]: ...
def get_prepopulated_fields(self, request: HttpRequest, obj: _ModelT | None = ...) -> dict[str, Sequence[str]]: ...
def get_queryset(self, request: HttpRequest) -> QuerySet[_ModelT]: ...
def get_sortable_by(self, request: HttpRequest) -> _DisplayT: ...
def get_sortable_by(self, request: HttpRequest) -> _DisplayT[_ModelT]: ...
def lookup_allowed(self, lookup: str, value: str) -> bool: ...
def to_field_allowed(self, request: HttpRequest, to_field: str) -> bool: ...
def has_add_permission(self, request: HttpRequest) -> bool: ...
Expand All @@ -133,8 +133,8 @@ _ModelAdmin = TypeVar("_ModelAdmin", bound=ModelAdmin)
_ActionCallable: TypeAlias = Callable[[_ModelAdmin, HttpRequest, QuerySet[_ModelT]], HttpResponseBase | None]

class ModelAdmin(BaseModelAdmin[_ModelT]):
list_display: _DisplayT
list_display_links: _DisplayT | None
list_display: _DisplayT[_ModelT]
list_display_links: _DisplayT[_ModelT] | None
list_filter: _ListOrTuple[_ListFilterT]
list_select_related: bool | _ListOrTuple[str]
list_per_page: int
Expand Down Expand Up @@ -200,8 +200,8 @@ class ModelAdmin(BaseModelAdmin[_ModelT]):
self, request: HttpRequest, default_choices: list[tuple[str, str]] = ...
) -> list[tuple[str, str]]: ...
def get_action(self, action: Callable | str) -> tuple[Callable[..., str], str, str] | None: ...
def get_list_display(self, request: HttpRequest) -> _DisplayT: ...
def get_list_display_links(self, request: HttpRequest, list_display: _DisplayT) -> _DisplayT: ...
def get_list_display(self, request: HttpRequest) -> _DisplayT[_ModelT]: ...
def get_list_display_links(self, request: HttpRequest, list_display: _DisplayT[_ModelT]) -> _DisplayT[_ModelT]: ...
def get_list_filter(self, request: HttpRequest) -> _ListOrTuple[_ListFilterT]: ...
def get_list_select_related(self, request: HttpRequest) -> bool | _ListOrTuple[str]: ...
def get_search_fields(self, request: HttpRequest) -> _ListOrTuple[str]: ...
Expand Down

0 comments on commit d8d5467

Please sign in to comment.