summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorBecky Smith <rebkwok@gmail.com>2017-03-30 10:13:15 +0100
committerTim Graham <timograham@gmail.com>2018-02-24 20:41:43 -0500
commit8116e588dbdd17171a322da589b691bdf01f7041 (patch)
treec46f319b831339ec9ee665e850f89bc3f3a169e0 /docs/ref
parent9822d88ca0dd855a668f9c33447aeac45a9768ac (diff)
Fixed #17962 -- Added ModelAdmin.get_deleted_objects().
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/admin/index.txt30
1 files changed, 30 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index d586513c9a..d1138076ff 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -1998,6 +1998,36 @@ templates used by the :class:`ModelAdmin` views:
def get_changeform_initial_data(self, request):
return {'name': 'custom_initial_value'}
+.. method:: ModelAdmin.get_deleted_objects(objs, request)
+
+ .. versionadded:: 2.1
+
+ A hook for customizing the deletion process of the :meth:`delete_view` and
+ the "delete selected" :doc:`action <actions>`.
+
+ The ``objs`` argument is a homogeneous iterable of objects (a ``QuerySet``
+ or a list of model instances) to be deleted, and ``request`` is the
+ :class:`~django.http.HttpRequest`.
+
+ This method must return a 4-tuple of
+ ``(deleted_objects, model_count, perms_needed, protected)``.
+
+ ``deleted_objects`` is a list of strings representing all the objects that
+ will be deleted. If there are any related objects to be deleted, the list
+ is nested and includes those related objects. The list is formatted in the
+ template using the :tfilter:`unordered_list` filter.
+
+ ``model_count`` is a dictionary mapping each model's
+ :attr:`~django.db.models.Options.verbose_name_plural` to the number of
+ objects that will be deleted.
+
+ ``perms_needed`` is a set of :attr:`~django.db.models.Options.verbose_name`\s
+ of the models that the user doesn't have permission to delete.
+
+ ``protected`` is a list of strings representing of all the protected
+ related objects that can't be deleted. The list is displayed in the
+ template.
+
Other methods
~~~~~~~~~~~~~