{% load addcss %}
{% if child.errors %}
<p class="alert alert-danger alert-dismissable">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
    Please correct the error{{ child.errors|pluralize }} below.
</p>
{% endif %}

{% if child.non_field_errors %}
{% for error in child.non_field_errors %}
<p class="alert alert-danger alert-dismissable">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
    {{ error }}
</p>
{% endfor %}
{% endif %}
<form action="{{ child.action }}" method="{{ child.method }}" role="form">
    {% csrf_token %}
    {% for field in child %}
    <div class="form-group{% if field.errors|length > 0 %} has-error {% endif %} has-feedback">
        <label for='{{ field.id_for_label }}' class="control-label">{{ field.label }}</label>
        {{field|addcss:"form-control"}}
        {% if field.errors|length > 0 %}<span
            class="glyphicon glyphicon-remove form-control-feedback"></span>
            <div class="alert alert-danger">
            	<button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
				{% for error in field.errors %} {{ error }} {% endfor %}
			</div>
        {% endif %}
    </div>
    {% endfor %}
    <input type="submit" value="Submit" class="btn btn-default">
</form>