<div class="modal fade" role="dialog">
  <div class="modal-dialog {% block size '' %}">
    <div class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">
          {% block title %}Title{% endblock %}
        </h4>
      </div>

      {% block body %}
        <div class="modal-body">
          <p>Body goes here.</p>
        </div>
      {% endblock %}

      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">
          Close
        </button>
        {% block submit %}
          <button type="submit" class="btn btn-primary">
            Submit
          </button>
        {% endblock %}
      </div>
    </div>
  </div>
  <script>
    {
      let dialog= document.currentScript.parentNode
      {% block script %}
      {% endblock %}
    }
  </script>
</div>

<div class="modal fade" role="dialog">
  <div class="modal-dialog {% block size '' %}">
    <form class="modal-content">

      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h4 class="modal-title">
          {% block title %}Title{% endblock %}
        </h4>
      </div>

      {% block body %}
        <div class="modal-body">
          <p>Body goes here.</p>
        </div>
      {% endblock %}

      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">
          Close
        </button>
        {% block submit %}
          <button type="submit" class="btn btn-primary">
            Submit
          </button>
        {% endblock %}
      </div>
    </div>
  </form>
  <script>
    {
      let dialog= document.currentScript.parentNode
      let form= dialog.getElementsByTagName('form')[0]

      {% block script %}
      {% endblock %}
    }
  </script>
</div>

Make all dialogs be a form
Make all dialogs be a form
