Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseDeleteView now extends FormMixin #1215

Merged
merged 2 commits into from Oct 28, 2022

Conversation

adamchainz
Copy link
Contributor

@adamchainz adamchainz commented Oct 28, 2022

I have made things!

Fixed conflict version of #849.

Changed in Django 4.0: django/django@3a45fea

https://docs.djangoproject.com/en/4.0/releases/4.0/#generic-views

Related issues

Fixes #1214.

Co-Authored-By: Simon Kohlmeyer <simon.kohlmeyer@gmail.com>
@@ -66,9 +66,9 @@ class DeletionMixin(Generic[_M]):
def delete(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
def get_success_url(self) -> str: ...

class BaseDeleteView(DeletionMixin[_M], BaseDetailView[_M]):
class BaseDeleteView(DeletionMixin[_M], FormMixin[_ModelFormT], BaseDetailView[_M]):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to explicitly add Generic[_M, _ModelFormT] when two vars are used this way.

Otherwise, it is easy to mix things up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, like the commit I just pushed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes :)

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sobolevn sobolevn merged commit 7bce5c2 into typeddjango:master Oct 28, 2022
@adamchainz adamchainz deleted the base_delete_view branch October 28, 2022 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

DeleteView doesn't expose get_form_kwargs because its missing grandparent type FormMixin
2 participants