1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

Refs #33263 -- Removed warning in BaseDeleteView when delete() method is overridden.

This commit is contained in:
Mariusz Felisiak
2023-01-13 09:55:34 +01:00
parent 94ad46e9d8
commit 003081468e
2 changed files with 1 additions and 45 deletions

View File

@@ -1,5 +1,3 @@
import warnings
from django.core.exceptions import ImproperlyConfigured
from django.forms import Form
from django.forms import models as model_forms
@@ -240,11 +238,6 @@ class DeletionMixin:
raise ImproperlyConfigured("No URL to redirect to. Provide a success_url.")
# RemovedInDjango50Warning.
class DeleteViewCustomDeleteWarning(Warning):
pass
class BaseDeleteView(DeletionMixin, FormMixin, BaseDetailView):
"""
Base view for deleting an object.
@@ -254,19 +247,6 @@ class BaseDeleteView(DeletionMixin, FormMixin, BaseDetailView):
form_class = Form
def __init__(self, *args, **kwargs):
# RemovedInDjango50Warning.
if self.__class__.delete is not DeletionMixin.delete:
warnings.warn(
f"DeleteView uses FormMixin to handle POST requests. As a "
f"consequence, any custom deletion logic in "
f"{self.__class__.__name__}.delete() handler should be moved "
f"to form_valid().",
DeleteViewCustomDeleteWarning,
stacklevel=2,
)
super().__init__(*args, **kwargs)
def post(self, request, *args, **kwargs):
# Set self.object before the usual form processing flow.
# Inlined because having DeletionMixin as the first base, for