{% if field.model %} {# ── Model-based relationship combobox ──────────────────────────────────────── Queries the model directly via the panel's GET /_model_search endpoint. The nuruCombobox Alpine component is registered in layout.html's alpine:init listener — nothing extra is needed here. Field attrs: field.model — SQLModel class (provides the model name in the URL) field.value_field — attr used as FK value (default: 'id') field.label_field — attr shown as label (default: str(record)) field.relationship — attr on *this* record for detail-view display only Context variables (injected by macros/form_item.html): current — current FK value (int / str / None) has_error — bool errors — dict { field_key: message } input_class — pre-built Tailwind input classes panel_prefix — URL prefix of this admin panel #} {% set _vf = field.value_field or 'id' %} {% set _lf = field.label_field or '' %} {% set _search_url = panel_prefix ~ '/_model_search?model=' ~ field.model.__name__ ~ '&value_field=' ~ _vf ~ ('&label_field=' ~ _lf if _lf else '') %}
{{ errors[field.key] }}
{% elif field.help_text %}{{ field.help_text }}
{% endif %}