avoiding for loop in django template tag

This commit is contained in:
Kristina Yin 2023-11-27 16:25:27 -08:00
parent 81b7bac482
commit 2e1ddd91e5
No known key found for this signature in database
GPG key ID: 9BB3845BB3A21584

View file

@ -21,25 +21,22 @@
{% endif %}
-->
{% if widget.attrs.required %}
{% for required_label in [
"What is the name of the tribe you represent?",
"Organization name",
"Street address",
"City",
"State, territory, or military post",
"Zip code",
"First name / given name",
"Last name / family name",
"Title or role in your organization",
"Email",
"Phone"
] %}
{% if field.label == required_label %}
<abbr class="usa-hint usa-hint--required" title="required"> *</abbr>
{% endif %}
{% endfor %}
{% if widget.attrs.required and field.label in [
"What is the name of the tribe you represent?",
"Organization name",
"Street address",
"City",
"State, territory, or military post",
"Zip code",
"First name / given name",
"Last name / family name",
"Title or role in your organization",
"Email",
"Phone"
] %}
<abbr class="usa-hint usa-hint--required" title="required">*</abbr>
{% endif %}
</{{ label_tag }}>