From 008662c09753ab3e472151ced743e18e6f85716e Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Wed, 25 May 2022 15:10:46 +0200 Subject: [PATCH 1/2] Fix BaseModelFormSet.save_m2m: accept `self` Before it would result in the following when calling it: > Attribute function "save_m2m" with type "Callable[[], None]" does not accept self argument [misc] --- django-stubs/forms/models.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi index d77d6c65f..f21c1f75c 100644 --- a/django-stubs/forms/models.pyi +++ b/django-stubs/forms/models.pyi @@ -150,7 +150,7 @@ class BaseModelFormSet(Generic[_M, _ModelFormT], BaseFormSet[_ModelFormT]): def save_existing(self, form: _ModelFormT, instance: _M, commit: bool = ...) -> _M: ... def delete_existing(self, obj: _M, commit: bool = ...) -> None: ... saved_forms: List[_ModelFormT] = ... - save_m2m: Callable[[], None] = ... + save_m2m: Callable[[self], None] = ... def save(self, commit: bool = ...) -> List[_M]: ... def clean(self) -> None: ... def validate_unique(self) -> None: ... From 1a6c7037b061825cdecb89119d0f8155739c99bc Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Fri, 27 May 2022 11:49:31 +0200 Subject: [PATCH 2/2] fixup! Fix BaseModelFormSet.save_m2m: accept `self` --- django-stubs/forms/models.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/forms/models.pyi b/django-stubs/forms/models.pyi index f21c1f75c..b0bc1dbc4 100644 --- a/django-stubs/forms/models.pyi +++ b/django-stubs/forms/models.pyi @@ -150,7 +150,7 @@ class BaseModelFormSet(Generic[_M, _ModelFormT], BaseFormSet[_ModelFormT]): def save_existing(self, form: _ModelFormT, instance: _M, commit: bool = ...) -> _M: ... def delete_existing(self, obj: _M, commit: bool = ...) -> None: ... saved_forms: List[_ModelFormT] = ... - save_m2m: Callable[[self], None] = ... + def save_m2m(self) -> None: ... def save(self, commit: bool = ...) -> List[_M]: ... def clean(self) -> None: ... def validate_unique(self) -> None: ...