mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-23 15:54:16 +03:00
Add --- null option for selects. Closes #2096.
This commit is contained in:
parent
6794b3380a
commit
9c6bead8b6
|
@ -4,6 +4,9 @@
|
|||
{% endif %}
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="{{ field.name }}">
|
||||
{% if field.allow_null %}
|
||||
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
|
||||
{% endif %}
|
||||
{% for key, text in field.choices.items %}
|
||||
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
|
||||
{% endfor %}
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<label class="sr-only">{{ field.label }}</label>
|
||||
{% endif %}
|
||||
<select class="form-control" name="{{ field.name }}">
|
||||
{% if field.allow_null %}
|
||||
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
|
||||
{% endif %}
|
||||
{% for key, text in field.choices.items %}
|
||||
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
|
||||
{% endfor %}
|
||||
|
|
|
@ -3,6 +3,9 @@
|
|||
<label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>
|
||||
{% endif %}
|
||||
<select class="form-control" name="{{ field.name }}">
|
||||
{% if field.allow_null %}
|
||||
<option value="" {% if not field.value %}selected{% endif %}>--------</option>
|
||||
{% endif %}
|
||||
{% for key, text in field.choices.items %}
|
||||
<option value="{{ key }}" {% if key == field.value %}selected{% endif %}>{{ text }}</option>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue
Block a user