{% for col in columns %}
{% set is_parent_id = parent_id_fields and col in parent_id_fields %}
{% set col_type = column_types.get(col, 'string') if column_types else 'string' %}
{% set constraints = column_constraints.get(col, {}) if column_constraints else {} %}
{% set ref_info = reference_fields.get(col, {}) if reference_fields else {} %}
{% set ontologies = column_ontologies.get(col, []) if column_ontologies else [] %}
{% set is_ontology = col_type == 'ontology_term' and not is_parent_id %}
{% set show_lookup = (ref_info and not is_parent_id) or is_ontology %}
{{ row.get(col, '')|display }}
{# A table cell gets the same control as the field
it holds: a date column was a text box here
while the form gave it a picker, so one value
was typed in one place and chosen in the other. #}
{% set cell_value = row.get(col, '')|display %}
{% if is_ontology %}
{% elif show_lookup %}
{% endif %}