Skip to content

delete_component

django_spire.core.components.confirmation.model.delete_component

BaseModelDeleteConfirmationComponent

Bases: BaseModelActionConfirmationComponent, ABC

A :class:BaseModelActionConfirmationComponent worded and guarded as a delete: confirming needs DELETE access, and title, message and confirm_label name the row and its model when left unset.

A subclass deletes the row in perform_action().

template = 'django_spire/component/confirmation/model_delete_confirmation.html' class-attribute instance-attribute

confirm_access = Glue.Access.DELETE class-attribute instance-attribute

ModelDeleteConfirmationComponent

Bases: BaseModelDeleteConfirmationComponent

Deletes the row from the database, with the model's delete().

perform_action

Source code in django_spire/core/components/confirmation/model/delete_component.py
def perform_action(self) -> None:
    self.instance.delete()

ModelSetDeletedConfirmationComponent

Bases: BaseModelDeleteConfirmationComponent

Soft-deletes the row, with the set_deleted() of Spire's history mixin.

perform_action

Source code in django_spire/core/components/confirmation/model/delete_component.py
def perform_action(self) -> None:
    self.instance.set_deleted()