From 9d92914a5403bbbad3897b409b7d66fc8fb4d3b2 Mon Sep 17 00:00:00 2001 From: Jae Hyuck Sa Date: Sun, 19 May 2024 20:59:00 +0900 Subject: [PATCH] 5.0: Update `django.forms.formsets` (#2145) * 5.0: Update django.forms.formsets * Improve typing of django.forms.BaseFormSet --- django-stubs/forms/formsets.pyi | 9 ++++++--- scripts/stubtest/allowlist_todo.txt | 6 ------ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/django-stubs/forms/formsets.pyi b/django-stubs/forms/formsets.pyi index f4e347603..540dd0263 100644 --- a/django-stubs/forms/formsets.pyi +++ b/django-stubs/forms/formsets.pyi @@ -3,8 +3,9 @@ from typing import Any, Generic, TypeVar from django.db.models.fields import _ErrorMessagesDict from django.forms.forms import BaseForm, Form +from django.forms.renderers import BaseRenderer from django.forms.utils import ErrorList, RenderableFormMixin, _DataT, _FilesT -from django.forms.widgets import Media, Widget +from django.forms.widgets import Media, MediaDefiningClass, Widget from django.utils.functional import cached_property TOTAL_FORM_COUNT: str @@ -44,8 +45,8 @@ class BaseFormSet(Generic[_F], Sized, RenderableFormMixin): initial: Sequence[Mapping[str, Any]] | None form_kwargs: dict[str, Any] error_class: type[ErrorList] - deletion_widget: type[Widget] - ordering_widget: type[Widget] + deletion_widget: MediaDefiningClass + ordering_widget: MediaDefiningClass default_error_messages: _ErrorMessagesDict template_name_div: str template_name_p: str @@ -61,6 +62,8 @@ class BaseFormSet(Generic[_F], Sized, RenderableFormMixin): error_class: type[ErrorList] = ..., form_kwargs: dict[str, Any] | None = ..., error_messages: Mapping[str, str] | None = ..., + form_renderer: BaseRenderer = ..., + renderer: BaseRenderer = ..., ) -> None: ... def __iter__(self) -> Iterator[_F]: ... def __getitem__(self, index: int) -> _F: ... diff --git a/scripts/stubtest/allowlist_todo.txt b/scripts/stubtest/allowlist_todo.txt index 515d15e9c..78a6788e6 100644 --- a/scripts/stubtest/allowlist_todo.txt +++ b/scripts/stubtest/allowlist_todo.txt @@ -407,8 +407,6 @@ django.contrib.gis.db.models.lookups.RasterBandTransform.as_sql django.contrib.gis.forms.ALL_FIELDS django.contrib.gis.forms.BaseForm.__init__ django.contrib.gis.forms.BaseFormSet.__init__ -django.contrib.gis.forms.BaseFormSet.deletion_widget -django.contrib.gis.forms.BaseFormSet.ordering_widget django.contrib.gis.forms.BaseModelForm.__init__ django.contrib.gis.forms.BaseModelForm.save_m2m django.contrib.gis.forms.BaseModelFormSet.model @@ -1274,8 +1272,6 @@ django.db.utils.DatabaseErrorWrapper.__call__ django.forms.ALL_FIELDS django.forms.BaseForm.__init__ django.forms.BaseFormSet.__init__ -django.forms.BaseFormSet.deletion_widget -django.forms.BaseFormSet.ordering_widget django.forms.BaseModelForm.__init__ django.forms.BaseModelForm.save_m2m django.forms.BaseModelFormSet.model @@ -1322,8 +1318,6 @@ django.forms.forms.BaseForm.__init__ django.forms.forms.DeclarativeFieldsMetaclass.__new__ django.forms.formset_factory django.forms.formsets.BaseFormSet.__init__ -django.forms.formsets.BaseFormSet.deletion_widget -django.forms.formsets.BaseFormSet.ordering_widget django.forms.formsets.ManagementForm.__init__ django.forms.formsets.formset_factory django.forms.inlineformset_factory