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 4 years, 3 months ago
- Form splitting/Fieldset templatetag by peritus 4 years, 8 months ago
- Add special field lookups to the Admin list_filter display by whiteinge 5 years, 3 months ago
- FieldsetForm by Ciantic 6 years, 1 month ago
- Fieldsets for Views by Nad/ 3 years, 4 months ago
Comments
Why not create a method like form.as_table()?
#