Skip to content

Instantly share code, notes, and snippets.

@whatcould
Created September 18, 2009 19:56
Show Gist options
  • Save whatcould/189257 to your computer and use it in GitHub Desktop.
Save whatcould/189257 to your computer and use it in GitHub Desktop.
<div class="primary_fields">
{{ form.list }}
{{ form.name }}
{{ form.description }}
{{ form.url }}
</div>
# etc
And each of the form.fieldname lines (whatever the markup would be) would be doing something like this, but maybe with real code instead of the template language:
{% if not field.is_hidden %}
<tr>
<td class="label">{{ field.label_tag }}</td>
<td class="form-field">
{% ifequal field.field.widget.input_type "text" %}<div class="field_wrap">{{ field }}</div>
{% else %}
{% ifequal field.field.widget.input_type "password" %}<div class="field_wrap">{{ field }}</div>
{% else %}
{% if field.field.widget.attrs.cols %}<div class="field_wrap">{{ field }}</div>
{% else %}
{{ field }}
{% endif %}{% endifequal %}{% endifequal %}
{{ field.errors }}
{% if field.help_text %}<p class="help">{{ field.help_text|safe }}</p>{% endif %}
</td>
</tr>
{% else %}
{{ field }}
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment