Last active
January 25, 2019 10:42
-
-
Save rubinhozzz/e375e35e3c3ff4b7c4968baf9f6f2483 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% load widget_tweaks %} | |
{% load common_tags %} | |
<form id="form_page" method="POST" action=""> | |
{% csrf_token %} | |
{% for field in form.hidden_fields %} | |
{{ field }} | |
{% endfor %} | |
{% for field in form.visible_fields %} | |
{% if field|is_checkbox %} | |
<div class="form-check"> | |
{% render_field field class='form-check-input' %} | |
<label for="{{ field.auto_id }}" class="{% if field.field.required %}required{% endif %}">{{ field.label }}:</label> | |
</div> | |
{% else %} | |
<div class="form-group {% if field.errors %}has-error{% endif %}"> | |
<label for="{{ field.auto_id }}" class="{% if field.field.required %}required{% endif %}"> | |
{{ field.label }}: {% if field.field.required %}<span class="mandatory-symbol">*</span>{% endif %} | |
</label> | |
{% if field.errors %} | |
{% render_field field class='form-control error-input' placeholder=field.label %} | |
{% else %} | |
{% render_field field class='form-control' placeholder=field.label %} | |
{% endif %} | |
<span class="error-block">{{ field.errors|striptags }}</span> | |
</div> | |
{% endif %} | |
{% endfor %} | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment