{% load i18n crispy_forms_tags %}

<form class="form-horizontal" action="" method="post">
    {% crispy form %}
    <div class="form-actions">
        <button type="submit" class="btn btn-primary">{% trans "Save Changes" %}</button>
    </div>
</form>

<script type="text/javascript">
    $(document).ready(function(){

        var msg = "{{ form.second_step_msg }}";
        var warning = "{{ form.warning_message }}";

        if(msg) {
            var msg_box = $("<div>")
                    .addClass("alert")
                    .addClass("alert-block")
                    .addClass("alert-info")
                    .append($("<p>").html(msg));
            $("#messages").append(msg_box);
        }

        if(warning) {
            var waring_box = $("<div>")
                    .addClass("alert")
                    .addClass("alert-block")
                    .addClass("alert-warning")
                    .append($("<p>").html(warning));
            $("#messages").append(waring_box);
        }

    });
</script>
