<div class="modal-header">
  <h2>{{ action_name }}</h2>
  <button class="modal-close">&times;</button>
</div>
<div class="modal-body">
  <p>{{ description }}</p>
  {% if form %}
  <form
    id="modal-form"
    method="post"
    action="{% if object %}{% url 'admin:'|add:opts.app_label|add:'_'|add:opts.model_name|add:'_execute_action' object.pk action %}{% else %}{% url 'admin:'|add:opts.app_label|add:'_'|add:opts.model_name|add:'_execute_list_action' action %}{% endif %}"
  >
    {% csrf_token %} {{ form.as_p }} {% if selected_ids %}
    <input type="hidden" name="selected_ids" value="{{ selected_ids }}" />
    {% endif %}
  </form>
  {% endif %}
</div>
<div class="modal-footer">
  {% if form %}
  <button type="submit" form="modal-form" class="button default">
    Confirm
  </button>
  <button class="button cancel">Cancel</button>
  {% else %}
  <form
    method="post"
    action="{% if object %}{% url 'admin:'|add:opts.app_label|add:'_'|add:opts.model_name|add:'_execute_action' object.pk action %}{% else %}{% url 'admin:'|add:opts.app_label|add:'_'|add:opts.model_name|add:'_execute_list_action' action %}{% endif %}"
  >
    {% csrf_token %} {% if selected_ids %}
    <input type="hidden" name="selected_ids" value="{{ selected_ids }}" />
    {% endif %}
    <button type="submit" class="button default">Confirm</button>
    <button class="button cancel">Cancel</button>
  </form>
  {% endif %}
</div>
