<form class="form-horizontal" role="form" method="post" action="">
    {% csrf_token %}

    <div class="form-group">
        {{ form.name.errors }}
        <label class="control-label col-sm-2" for="{{ form.name.id_for_label }}">Name</label>
        <div class="col-sm-10">
            {{ form.name }}
        </div>
    </div>

    <div class="form-group">
        {{ form.service.errors }}
        <label class="control-label col-sm-2" for="{{ form.service.id_for_label }}">Service</label>
        <div class="col-sm-10">
            {{ form.service }}
        </div>
    </div>

    <div class="form-group">
        {{ form.service_status.errors }}
        <label class="control-label col-sm-2" for="{{ form.service_status.id_for_label }}">Service status</label>
        <div class="col-sm-10">
            {{ form.service_status }}
        </div>
    </div>

    <div class="form-group">
        {{ form.occurred.errors }}
        <label class="control-label col-sm-2" for="{{ form.occurred.id_for_label }}">Occurred</label>
        <div class="col-sm-10">
            {{ form.occurred }}
        </div>
    </div>

    {{ incident_updates.management_form }}
    {% for form in incident_updates %}
    <div class="panel panel-default">
        <div class="panel-heading">Incident update #{{ forloop.counter }}</div>
        <div class="panel-body">
            <div class="form-group">
                {{ form.status.errors }}
                {{ form.id }}
                <label class="control-label col-sm-2" for="{{ form.status.id_for_label }}">Status</label>
                <div class="col-sm-10">
                    {{ form.status }}
                </div>
            </div>
            <div class="form-group">
                {{ form.description.errors }}
                <label class="control-label col-sm-2" for="{{ form.description.id_for_label }}">Description</label>
                <div class="col-sm-10">
                    {{ form.description }}
                </div>
            </div>

            {% if incident_updates.can_delete %}
            <div class="form-group">
                <label class="control-label col-sm-2" for="{{ form.DELETE.id_for_label }}">Delete</label>
                <div class="col-sm-10">
                    {{ form.DELETE }}
                </div>
            </div>
            {% endif %}
        </div>
    </div>

    {% endfor %}

    <div class="form-group">
        <div class="col-sm-10 col-sm-offset-2">
            <input type="submit" class="btn btn-primary" value="Submit">
        </div>
    </div>
</form>

