{% 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 template_mode != 'inline_edit' and 'calculation' in schema %} {% if is_template %} {% else %} {% include "objects/forms/calculation_script.html" %} {% endif %} {% endif %}