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>
This commit is contained in:
25
aircox/templates/aircox/dashboard/widgets/form_field.html
Normal file
25
aircox/templates/aircox/dashboard/widgets/form_field.html
Normal file
@ -0,0 +1,25 @@
|
||||
{% 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 ":value" attribute
|
||||
- vbind: if True, use ":value" instead of "value"
|
||||
- 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 }}" {% if value %}checked{% endif %}>
|
||||
{% elif field|is_select %}
|
||||
<select name="{{ name }}" class="select" value="{{ value|default:"" }}">
|
||||
{% for value, label in field.widget.choices %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
{% else %}
|
||||
<input type="text" class="input" name="{{ name }}" value="{{ value|default:"" }}">
|
||||
{% endif %}
|
Reference in New Issue
Block a user