mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-26 12:38:36 +02:00
32 lines
No EOL
1.3 KiB
HTML
32 lines
No EOL
1.3 KiB
HTML
{% load static custom_filters %}
|
|
|
|
<div class="{{ uswds_input_class }}">
|
|
{% for group, options, index in widget.optgroups %}
|
|
{% if group %}<div><label>{{ group }}</label>{% endif %}
|
|
{% for option in options %}
|
|
<input
|
|
type="{{ option.type }}"
|
|
name="{{ option.name }}"
|
|
{# hint: spacing in the class string matters #}
|
|
class="{{ uswds_input_class }}__input {% if classes %} {{ classes }}{% endif %}"
|
|
{% if option.value != None %}value="{{ option.value|stringformat:'s' }}"{% endif %}
|
|
{% include "django/forms/widgets/attrs.html" with widget=option %}
|
|
/>
|
|
<label
|
|
class="{{ uswds_input_class }}__label{% if label_classes %} {{ label_classes }}{% endif %}"
|
|
for="{{ option.attrs.id }}"
|
|
>
|
|
{{ option.label }}
|
|
{% comment %} Add a description on each, if available {% endcomment %}
|
|
{% if field and field.field and field.field.descriptions %}
|
|
{% with description=field.field.descriptions|get_dict_value:option.value %}
|
|
{% if description %}
|
|
<p class="margin-0 margin-top-1 font-body-2xs">{{ description }}</p>
|
|
{% endif %}
|
|
{% endwith %}
|
|
{% endif %}
|
|
</label>
|
|
{% endfor %}
|
|
{% if group %}</div>{% endif %}
|
|
{% endfor %}
|
|
</div> |