<div class="modal-dialog modal-lg">
    <div class="modal-content">
        <div class="modal-header">
            <h4 class="modal-title">{{page_title|safe}}{% block title %}{% endblock %}</h4>
            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
              <span aria-hidden="true">&times;</span>
            </button>
        </div>
        <div class="modal-body">
            {% block content %}{% endblock %}
        </div>
        <div class="modal-footer">
            {% block footer %}{% endblock %}
        </div>
        <script>
            $('.modal-content form').on('submit', function(e) {
                e.preventDefault();
                data = $(this).serialize();
                action = $(this).attr('action');
                $.post(action, data, function(resp) {
                    $('#modal').html(resp);
                });
            });
        </script>
    </div>
</div>
