Skip to content

ConfirmationActionMixin

ConfirmationActionMixin

djadmin.actions.base.ConfirmationActionMixin

Mixin for actions that require confirmation.

Displays a confirmation page before executing the action. Common for Delete actions.

Class Attributes

Attribute Type Description
confirmation_message - Message to display (optional)
template_name - Template to use (optional)

Method Resolution Order

  1. djadmin.actions.base.ConfirmationActionMixin

Attributes

Attribute Value Defined in
__annotations__ {'confirmation_message': str | None, 'template_name': <cl... djadmin.actions.base.ConfirmationActionMixin
confirmation_message None djadmin.actions.base.ConfirmationActionMixin
template_name djadmin/actions/confirm.html djadmin.actions.base.ConfirmationActionMixin
view_type confirmation djadmin.actions.base.ConfirmationActionMixin

Methods

get_confirmation_message(self, obj=None, queryset=None) -> str

Defined in: <class 'djadmin.actions.base.ConfirmationActionMixin'>

Get confirmation message to display.

Args: obj: Single object (for record actions) queryset: Multiple objects (for bulk actions)

Returns: Confirmation message string

Source code in base.py line 517
    def get_confirmation_message(self, obj=None, queryset=None) -> str:
        """
        Get confirmation message to display.

        Args:
            obj: Single object (for record actions)
            queryset: Multiple objects (for bulk actions)

        Returns:
            Confirmation message string
        """
        if self.confirmation_message:
            return self.confirmation_message

        if obj:
            return f"Are you sure you want to {self.label.lower()} '{obj}'?"
        elif queryset:
            count = queryset.count()
            return f'Are you sure you want to {self.label.lower()} {count} items?'

        return f'Are you sure you want to {self.label.lower()}?'

get_template_name(self) -> str

Defined in: <class 'djadmin.actions.base.ConfirmationActionMixin'>

Get template name for confirmation view

Source code in base.py line 539
    def get_template_name(self) -> str:
        """Get template name for confirmation view"""
        return self.template_name

Fields

Field Type Related To
__dict__ getset_descriptor -
__weakref__ getset_descriptor -