Content: Templates

Standard form tag

Simplest possible way of displaying a form, You can simply copy-paste this snippet and you will have a perfect form.

{% load standard_form %}

<form action="" method="post" class="frm">
	{% csrf_token %}
	<fieldset class="frm-horizontal">
		{% standard_form form %}
		{% standard_submit %}
	</fieldset>
</form>

 

Standard field tag

If you have to separate fields into different containers (because they have to be styled differently, for example), use the standard_field tag.

<form action="" method="post" class="frm">
	{% csrf_token %}
	<fieldset class="frm-horizontal">
		<ol>
			<li>{% standard_field form.field_name_one %}</li>
		</ol>
	</fieldset>
	<fieldset class="frm-vertical">
		<ol>
			<li>{% standard_field form.field_name_two %}</li>
		</ol>
		{% standard_submit %}
	</fieldset>
</form>

 

Standard widget tag

If you are doing something really fancy, you can break down a field even more – to the bare field widget. This example also includes it's own submit button.

<form action="" method="post" class="frm">
	{% csrf_token %}
	<fieldset class="frm-horizontal">
		<ol>
			 <li>
				 <label for="id_{{ form.field_name_one.name }}">My label or other stuff</label>
				 <div class="field">{% standard_widget form.field_name_one %}</div>
			 </li>
			 <li>
				 <label class="empty"></label>
				 <div class="field"><input type="submit" class="btn" value="{% trans 'Go' %}" /></div>
			 </li>
		</ol>
	</fieldset>
</form>

 

Full example

Example with all available options

{% standard_field form.email 'no_required no_required_helper no_help_text no_error_text' custom_class='input-block' placeholder='This one has all the available options' label='My label' %}

Another example

  1. This is some help text for this field.
  2. A confirmation email will be sent to this address.

Code

{% standard_form form "no_required" custom_class="input-block" %}