You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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", )defmark_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.")
returnconfirm_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",
)
The text was updated successfully, but these errors were encountered:
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:
API
The text was updated successfully, but these errors were encountered: