summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorVasilis Aggelou <dimitrovasilis@hotmail.com>2017-09-04 12:24:34 +0300
committerTim Graham <timograham@gmail.com>2018-01-05 18:28:45 -0500
commit777f216d555496798a1e65fd899b0f8a0349aeca (patch)
treec7019a417caf39f4d7a9acfd6b7629029befa3cc /docs
parentec2ce4517ac89f6c6334fe5322d1fc2007dfcbd4 (diff)
Fixed #15522 -- Added ModelAdmin.delete_queryset() to customize "delete selected objects" deletion.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/contrib/admin/actions.txt5
-rw-r--r--docs/ref/contrib/admin/index.txt9
-rw-r--r--docs/releases/2.1.txt3
3 files changed, 15 insertions, 2 deletions
diff --git a/docs/ref/contrib/admin/actions.txt b/docs/ref/contrib/admin/actions.txt
index c6f210b1de..c23c647a72 100644
--- a/docs/ref/contrib/admin/actions.txt
+++ b/docs/ref/contrib/admin/actions.txt
@@ -27,8 +27,9 @@ models. For example, here's the user module from Django's built-in
has an important caveat: your model's ``delete()`` method will not be
called.
- If you wish to override this behavior, simply write a custom action which
- accomplishes deletion in your preferred manner -- for example, by calling
+ If you wish to override this behavior, you can override
+ :meth:`.ModelAdmin.delete_queryset` or write a custom action which does
+ deletion in your preferred manner -- for example, by calling
``Model.delete()`` for each of the selected items.
For more background on bulk deletion, see the documentation on :ref:`object
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index 1f7b7f152e..7622477036 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -1391,6 +1391,15 @@ templates used by the :class:`ModelAdmin` views:
operations. Call ``super().delete_model()`` to delete the object using
:meth:`.Model.delete`.
+.. method:: ModelAdmin.delete_queryset(request, queryset)
+
+ .. versionadded:: 2.1
+
+ The ``delete_queryset()`` method is given the ``HttpRequest`` and a
+ ``QuerySet`` of objects to be deleted. Override this method to customize
+ the deletion process for the "delete selected objects" :doc:`action
+ <actions>`.
+
.. method:: ModelAdmin.save_formset(request, form, formset, change)
The ``save_formset`` method is given the ``HttpRequest``, the parent
diff --git a/docs/releases/2.1.txt b/docs/releases/2.1.txt
index f349d1ed9a..4d86380102 100644
--- a/docs/releases/2.1.txt
+++ b/docs/releases/2.1.txt
@@ -37,6 +37,9 @@ Minor features
* jQuery is upgraded from version 2.2.3 to 3.2.1.
+* The new :meth:`.ModelAdmin.delete_queryset` method allows customizing the
+ deletion process of the "delete selected objects" action.
+
:mod:`django.contrib.admindocs`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~