mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-20 02:41:16 +08:00
Fix incorrect instance arg for BaseInlineFormSet.__init__ (#928)
* Fix BaseInlineFormSet generic to retain parent model class info * Add in test for generic formset improvements
This commit is contained in:
@@ -296,7 +296,7 @@ _ParentModelT = TypeVar("_ParentModelT", bound=Model)
|
||||
class InlineModelAdmin(Generic[_ChildModelT, _ParentModelT], BaseModelAdmin[_ChildModelT]):
|
||||
model: Type[_ChildModelT] = ...
|
||||
fk_name: Optional[str] = ...
|
||||
formset: Type[BaseInlineFormSet[_ChildModelT, forms.ModelForm[_ChildModelT]]] = ...
|
||||
formset: Type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]] = ...
|
||||
extra: int = ...
|
||||
min_num: Optional[int] = ...
|
||||
max_num: Optional[int] = ...
|
||||
@@ -318,7 +318,7 @@ class InlineModelAdmin(Generic[_ChildModelT, _ParentModelT], BaseModelAdmin[_Chi
|
||||
def get_max_num(self, request: HttpRequest, obj: Optional[_ParentModelT] = ..., **kwargs: Any) -> Optional[int]: ...
|
||||
def get_formset(
|
||||
self, request: HttpRequest, obj: Optional[_ParentModelT] = ..., **kwargs: Any
|
||||
) -> Type[BaseInlineFormSet[_ChildModelT, forms.ModelForm[_ChildModelT]]]: ...
|
||||
) -> Type[BaseInlineFormSet[_ChildModelT, _ParentModelT, forms.ModelForm[_ChildModelT]]]: ...
|
||||
def get_queryset(self, request: HttpRequest) -> QuerySet[_ChildModelT]: ...
|
||||
def has_add_permission(self, request: HttpRequest, obj: Optional[_ParentModelT]) -> bool: ... # type: ignore
|
||||
def has_change_permission(self, request: HttpRequest, obj: Optional[_ParentModelT] = ...) -> bool: ... # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user