Skip to main content

delete_selected

Default action which deletes the selected objects.

This action first displays a confirmation page which shows all the deletable objects, or, if the user has no permission one of the related childs (foreignkeys), a "permission denied" message.

Next, it deletes all selected objects and redirects back to the change list.

def delete_selected(
modeladmin: ModelAdmin,
request: HttpRequest,
queryset: QuerySet
) - > TemplateResponse | None

Default action which deletes the selected objects. This action first displays a confirmation page which shows all the deletable objects, or, if the user has no permission one of the related childs (foreignkeys), a "permission denied" message. Next, it deletes all selected objects and redirects back to the change list.

Parameters

NameTypeDescription
modeladminModelAdminThe ModelAdmin instance representing the current model's administrative interface.
requestHttpRequestThe current HTTP request object containing user session and POST data for confirmation.
querysetQuerySetThe set of model instances selected by the user to be deleted.

Returns

TypeDescription
`TemplateResponseNone`