{% if schema['units'] in ("1", "") %}
{% else %}
{% if schema['units'] is string or schema['units'] | length == 1 %} {% set unit = schema["units"] if schema["units"] is string else schema["units"][0] %} {% if data is not none %}{{ (data | to_datatype).units | prettify_units }}{% else %}{{ unit | prettify_units }}{% endif %} {% else %} {% if id_prefix + '_units' in form_data %} {% set selected_unit = form_data[id_prefix + '_units'] %} {% elif data is not none %} {% set selected_unit = (data | to_datatype).units %} {% else %} {% set selected_unit = schema['units'][0] %} {% endif %} {% endif %}
{% endif %} {% if id_prefix+'_magnitude' in errors %} {{ errors[id_prefix+'_magnitude'] }} {% endif %}