Skip to content

Instantly share code, notes, and snippets.

@alxpck
Created April 9, 2015 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alxpck/fb34bf9e0a21bf2288cc to your computer and use it in GitHub Desktop.
Save alxpck/fb34bf9e0a21bf2288cc to your computer and use it in GitHub Desktop.
{% extends "base/theme.html" %}
{% load widget_tweaks %}
{% block main_content %}
<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|add_class:"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 %}
@alxpck
Copy link
Author

alxpck commented Apr 9, 2015

From One Month Python Course
Teacher: https://github.com/neuman

This is custom Django code that will work for any form.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment