forked from rc/aircox
cfr #121 Co-authored-by: Christophe Siraut <d@tobald.eu.org> Co-authored-by: bkfox <thomas bkfox net> Co-authored-by: Thomas Kairos <thomas@bkfox.net> Reviewed-on: rc/aircox#131 Co-authored-by: Chris Tactic <ctactic@noreply.git.radiocampus.be> Co-committed-by: Chris Tactic <ctactic@noreply.git.radiocampus.be>
25 lines
862 B
HTML
25 lines
862 B
HTML
{% comment %}
|
|
Render a form field instance as field (to be used when no model instance is provided). Value is binded as vue, class to Bulma
|
|
|
|
Context:
|
|
- name: field name
|
|
- field: form field
|
|
- value: input ":v-model" attribute
|
|
- hidden: if True, hidden field
|
|
{% endcomment %}
|
|
{% load aircox %}
|
|
|
|
{% if field.widget.is_hidden or hidden %}
|
|
<input type="hidden" :name="{{ name }}" :value="{{ value|default:"" }}">
|
|
{% elif field|is_checkbox %}
|
|
<input type="checkbox" class="checkbox" :name="{{ name }}" v-model="{{ value }}">
|
|
{% elif field|is_select %}
|
|
<select :name="{{ name }}" class="select" v-model="{{ value|default:"" }}">
|
|
{% for value, label in field.widget.choices %}
|
|
<option value="{{ value }}">{{ label }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
<input type="text" class="input" :name="{{ name }}" v-model="{{ value|default:"" }}">
|
|
{% endif %}
|