Jump to >

djblets.util.templatetags.djblets_forms

label_tag(field)[source]

Outputs the tag for a field’s label. This gives more fine-grained control over the appearance of the form.

This exists because a template can’t access this directly from a field in newforms.

form_field_id(field)[source]

Outputs the ID of a field.

is_field_checkbox(field)[source]

Return whether or not this field is a checkbox field.

is_checkbox_row(field)[source]

Returns whether the field’s row is a checkbox-ish row.

This will return True if rendering a checkbox, radio button, or multi-select checkbox.

form_field_has_label_first(field)[source]

Returns whether or not this field should display the label before the widget. This is the case in all fields except checkboxes.

get_fieldsets(form)[source]

Normalize and iterate over fieldsets in a form.

This will loop through the fieldsets on a given form, converting either standard Django style or legay Djblets style fieldset data into a standard form and returning it to the template.

Parameters:form (django.forms.Form) – The form containing the fieldsets.
Yields:tuple – A tuple of (fieldset_title, fieldset_info).

Example

{% for fieldset_title, fieldset in form|get_fieldsets %}
...
{% endfor %}