Skip to content

Instantly share code, notes, and snippets.

@neuman
Created March 10, 2015 22:16
Show Gist options
  • Select an option

  • Save neuman/4b0e0202cceb9f153f71 to your computer and use it in GitHub Desktop.

Select an option

Save neuman/4b0e0202cceb9f153f71 to your computer and use it in GitHub Desktop.
djangoform
{% extends "base/theme.html" %}
{% load addattr %}
{% block maincontent %}
<div class="header-buffer">
</div>
<section id="services">
<div class="container">
<div class="row">
{% if form %}
<div class="col-md-12">
<form action="" method="post" enctype="multipart/form-data">{% csrf_token %}{{ form.media }}
{% for field in form %}
<div class="form-group warning">
<label for="exampleInputFile">{{ field.label }}</label>
{{ field|addattr:"form-control"}}
{% if field.help_text %}<p class="help-block">{{ field.help_text }}</p>{% endif %}
</div>
{% if field.errors %}
{% for error in field.errors %}
<div class="alert alert-danger" id="error_{{ field.name }}">{{ error|escape }}</div>
{% endfor %}
{% endif %}
{% endfor %}
<input type="submit" class="btn btn-success" role="button" value="{{ verb|default:"Submit" }}" />
</form>
</div>
{% endif %}
</div>
</div>
</section>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment