{% csrf_token %}
Fields marked with * are required.
{# Loop over all data categories #} {% for category, data_items in data_format.items %}

{{ data_items.label }}

{# Loop over all data items in this category #} {% for name, data in data_items.data.items %}
{% if data.type == "enum" %} {# Render enum options as a drop-down select element #} {% elif data.type == "boolean" %} {# Render boolean options as a simple checkbox element #} {% elif data.type == "dict" %} {# Render dict options as a list of paired key-value inputs #}
{# First, render any pre-defined key-value pairs #} {% for key, value in data.default.items %}
{% endfor %}{# loop over existing key-value pairs in this dict #} {# At the end, there should always be a blank key-value pair #}
{% elif data.type == "upload" %} {% else %} {# Not an enum, boolean, or dict - all other types use an input element #} {% endif %} {% if data.type != "boolean" and data.type != "upload" %} {# Boolean checkboxes got their own label above. Everything else needs a label now #} {% endif %}
{% endfor %}{# loop over all items in this category #}
{% endfor %}{# loop over all categories #}