DeleteView in Django4.0 does not call .delete() method

202 views
Skip to first unread message

Eugene Prikazchikov

unread,
Nov 3, 2021, 9:01:31 AM11/3/21
to Django users
Hi there,

I am giving a try to Django 4.0 on one of my projects and I see that DeleteView does not call .delete() method anymore. Instead, it only calls self.object.delete().
This breaks my code, since some of my views override .delete() method to do extra work on object deletion (for example to make some external API calls, etc)

As I understand, this was introduced when implementing the ticket https://code.djangoproject.com/ticket/21936
particularly this line https://github.com/django/django/commit/3a45fea0832c5910acee6e0d29f230f347a50462#diff-bf5815bb9e60d6b9f1a261957863a70cc9ad03efdbd7941c0e1659b7ceb2895fR250
Now DeletionMixin.post and DeletionMixin.delete methods are essentially shadowed (never get called).

Is it a bug or intended behavior?
If it is a bug, is there an existing ticket for this issue? If needed, I am open to create one and perhaps provide tests/PR for it (the bug seems rather small and approachable for newcomer).
If not - then doc probably should more clearly say that .delete() method is not working anymore.

Thank you,
Eugene

Eugene Prikazchikov

unread,
Nov 4, 2021, 5:30:18 AM11/4/21
to Django users
Reply all
Reply to author
Forward
0 new messages