1 2 3 4 5 6 7 8 9 10 11 12 13 | from django import template
register = template.Library()
@register.filter
def form_row(value):
# Change the template string below to suit your needs.
row = template.Template("""
<div class="form-row{% if field.errors %} errors{% endif %}">
{{ field.errors }}{{ field.label_tag }}{{ field }}
</div>
""")
return row.render(template.Context({'field': value}))
|
More like this
- BetterForm with fieldsets and row_attrs by carljm 3 years ago
- SectionedForm by marinho 3 years, 8 months ago
- Form splitting/Fieldset templatetag by peritus 3 years, 5 months ago
- FieldsetForm by Ciantic 4 years, 10 months ago
- Fieldsets for Views by Nad/ 2 years ago
Comments
Why not create a method like form.as_table()?
#