Closed as not planned
Description
The confirm action is useful when the user is presented with one option and some information about the action.
For some cases it could be useful to present the user with multiple options. A further extension to this could be to add some description on each option.
Some mockup:
**Do you want to mark order 123 from customer jane@example.com as paid?**
<Button: Mark as paid without sending receipt>
Will only mark as paid.
<Button: Mark as paid and send receipt>
Will send an email after marking the order as paid
API
@button(
label="Manage payment",
)
def mark_as_paid(self, request, pk):
order: shop.models.Order = self.get_object(request, pk)
@multi_action(label="Mark as paid without sending receipt", description="Will only mark as paid.")
def _action_charge_order(_request):
order.charge()
self.message_user(_request, message="Charged.")
@multi_action(label="Mark as paid and send receipt", description="Will send an email after marking the order as paid.")
def _action_charge_order_and_email(_request):
order.charge_and_email()
self.message_user(_request, message="Charged and emailed.")
return confirm_action(
self,
request,
actions=[_action_charge_order, _action_charge_order_and_email],
message=f"Do you want to mark order {order.pk} from customer {order.custome} as paid",
)