Last active
October 8, 2015 23:48
-
-
Save mtrythall/3406637 to your computer and use it in GitHub Desktop.
Basic field include for Django templates
This file contains 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
<div class="field {% if field_class %} {{ field_class }}{% endif %}"> | |
<label for="id_{{ field.html_name }}"> | |
{% if label %}{{ label }}{% else %}{{ field.label }}{% endif %} | |
{% if not field.required %}<small>optional</small>{% endif %} | |
</label> | |
{{ field }} | |
{% if help_text %} | |
<p class="help-text">{{ help_text }}</p> | |
{% elif field.help_text %} | |
<p class="help-text">{{ field.help_text }}</p> | |
{% endif %} | |
{{ field.errors }} | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment