-
-
Notifications
You must be signed in to change notification settings - Fork 505
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Bug report
The type-stubs for BaseDeleteView
and DeleteView
incorrectly require the form value to be a ModelForm
, while Django documentation implies a plain Form
should be enough.
What's wrong
The Django stubs for django.views.generic.edit
state the following:
class BaseDeleteView(Generic[_M, _ModelFormT], DeletionMixin[_M], FormMixin[_ModelFormT], BaseDetailView[_M]):
class DeleteView(Generic[_M, _ModelFormT], SingleObjectTemplateResponseMixin, BaseDeleteView[_M, _ModelFormT]):
looking at the actual implementation however,
class BaseDeleteView(DeletionMixin, FormMixin, BaseDetailView):
...
form_class = Form
The Django documentation itself also states that the default form is the empty form: https://docs.djangoproject.com/en/5.2/ref/class-based-views/generic-editing/#django.views.generic.edit.DeleteView.form_class, suggesting that using a non-model-form is indeed acceptable behavior.
How is that should be
I think the stubs should read
class BaseDeleteView(Generic[_M, _FormT], DeletionMixin[_M], FormMixin[_FormT], BaseDetailView[_M]):
class DeleteView(Generic[_M, _FormT], SingleObjectTemplateResponseMixin, BaseDeleteView[_M, _FormT]):
System information
(I think all of the following are irrelevant, but just in case):
- OS: Debian Linux.
python
version: Python 3.13.6django
version: 5.2.5mypy
version: 1.17.1django-stubs
version: 5.2.2django-stubs-ext
version: 5.2.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working