Skip to content

Instantly share code, notes, and snippets.

@tiagoamx
Last active December 1, 2016 18:47
Show Gist options
  • Save tiagoamx/3dda46482e967568464ff9df74c685ec to your computer and use it in GitHub Desktop.
Save tiagoamx/3dda46482e967568464ff9df74c685ec to your computer and use it in GitHub Desktop.
Form Dinamico django horinzontal span6
{% if form.non_field_errors %}
<div class="alert alert-error">
{% for error in form.non_field_errors %}
{{error}}
{% endfor %}
</div>
{% endif %}
<form class="form-horizontal" action="{{ form_action }}" method="post"
enctype="multipart/form-data" id="form-novo-movimento" name="form-novo-movimento">
{% csrf_token %}
<div class="row-fluid">
{% for form_field in form %}
{% if not form_field.is_hidden %}
<div class="span6">
<div class="control-group {% if form_field.errors %}error{% endif %}" >
<label class="control-label" for="{{ form_field.id_for_label }}"><small>{{ form_field.label }}:</small></label>
<div class="controls">
{{ form_field }}
{% if form_field.errors %}
{% for error in form_field.errors %}
<p id="error_{{ forloop.counter }}_{{ form_field.auto_id }}"
class="help-block">
<strong>{{ error }}</strong></p>
{% endfor %}
{% endif %}
{% if form_field.help_text %}
<p id="hint_{{ form_field.auto_id }}"
class="muted">{{ form_field.help_text|safe }}</p>
{% endif %}
</div>
</div>
</div>
{% else %}
{{ form_field }}
{% endif %}
{% endfor %}
</div>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment