#33263: DeleteView in Django4.0 does not call .delete() method
-----------------------------------------+------------------------
Reporter: eprikazc | Owner: nobody
Type: Bug | Status: new
Component: Generic views | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
I am giving a try to Django 4.0 on one of my projects and I see that
DeleteView.post does not call .delete() method anymore.
I understand that it was introduced when implementing the ticket
https://code.djangoproject.com/ticket/21936
particularly this line
https://github.com/django/django/commit/3a45fea0832c5910acee6e0d29f230f347a50462
#diff-bf5815bb9e60d6b9f1a261957863a70cc9ad03efdbd7941c0e1659b7ceb2895fR250
Some codebases in the wild might assume that .delete() method get always
called when DeleteView performs a deletion. I.e. .delete() method can be
seen not just as a handler for DELETE http method, but as part of public
interface of DeleteView - a place to specify what happens on object
deletion. For example, in my project I often override .delete() method to
do extra work - to make external API call or add a flash message, etc.
With Django4.0 it isn't working anymore.
If it is a bug - here is my attempt with test and fix for it -
https://github.com/django/django/pull/15055
If it is not a bug but intended behavior - perhaps it should be more
clearly documented, since it might break backwards compatibility for some
codebases.
--
Ticket URL: <https://code.djangoproject.com/ticket/33263>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.96c704ccbae04bd37a6874696e7d6048%40djangoproject.com.