diff options
| author | Rodrigo Vieira <rodrigo.vieira@gmail.com> | 2026-04-22 18:53:27 -0300 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-04-22 22:22:55 -0400 |
| commit | fa2a3de6ede10b005fc2c1d23f4cffb53eaec425 (patch) | |
| tree | 2fbb49592272a9b5b54ae9457ba0e2072dabe74f /docs/ref/contrib/admin | |
| parent | a586f03f36f511064f171c0e30f4ca2ebfd60085 (diff) | |
Fixed #10919 -- Added delete_confirmation_max_display to ModelAdmin.
The new ModelAdmin.delete_confirmation_max_display attribute allows
limiting the number of related objects shown on the delete confirmation
page. When the limit is reached, a "…and N more objects." message is shown.
The feature relies on a new truncated_unordered_list template filter
added to django.contrib.admin.templatetags.admin_filters.
Thanks Jacob Tyler Walls for the review and guidance, Tobias McNulty for the report,
and terminator14 for the solution suggested.
Diffstat (limited to 'docs/ref/contrib/admin')
| -rw-r--r-- | docs/ref/contrib/admin/index.txt | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt index b3c7c2c426..4b0e4a985d 100644 --- a/docs/ref/contrib/admin/index.txt +++ b/docs/ref/contrib/admin/index.txt @@ -1386,6 +1386,21 @@ default templates used by the :class:`ModelAdmin` views: for displaying a confirmation page when deleting one or more objects. See the :doc:`actions documentation</ref/contrib/admin/actions>`. +.. attribute:: ModelAdmin.delete_confirmation_max_display + + .. versionadded:: 6.1 + + Set ``delete_confirmation_max_display`` to control how many objects are + displayed on the delete confirmation pages before truncating the remainder + with an ellipsis. + + The limit applies to the total number of displayed objects across the + relationship hierarchy. This is purely a display setting and does not + affect the total number of objects retrieved from the database. + + This applies to both :meth:`delete_view` and the ``delete_selected`` + action. By default, this is ``None`` (no truncation). + .. attribute:: ModelAdmin.object_history_template Path to a custom template, used by :meth:`history_view`. @@ -2283,6 +2298,7 @@ adds some of its own (the shared features are actually defined in the - :attr:`~ModelAdmin.fieldsets` - :attr:`~ModelAdmin.fields` - :attr:`~ModelAdmin.formfield_overrides` +- :attr:`~ModelAdmin.delete_confirmation_max_display` - :attr:`~ModelAdmin.exclude` - :attr:`~ModelAdmin.filter_horizontal` - :attr:`~ModelAdmin.filter_vertical` |
