diff options
| author | Tom Christie | 2015-02-26 13:20:45 +0000 | 
|---|---|---|
| committer | Tom Christie | 2015-02-26 13:20:45 +0000 | 
| commit | 6bbd509f345b150cdfa9b5c17ca500c0c9fbf601 (patch) | |
| tree | 25d7cc95846a637b32febe9f671558e0b9d963d5 | |
| parent | 8f988466a594f9c0b6a7e6a2ed76c0b27a7f1895 (diff) | |
| parent | 88cd86c956375b23adec1908182cef342174a4ae (diff) | |
| download | django-rest-framework-6bbd509f345b150cdfa9b5c17ca500c0c9fbf601.tar.bz2 | |
Merge branch 'master' of https://github.com/tomchristie/django-rest-framework
3 files changed, 21 insertions, 6 deletions
| diff --git a/rest_framework/templates/rest_framework/horizontal/select_multiple.html b/rest_framework/templates/rest_framework/horizontal/select_multiple.html index 01c251fb..0735f280 100644 --- a/rest_framework/templates/rest_framework/horizontal/select_multiple.html +++ b/rest_framework/templates/rest_framework/horizontal/select_multiple.html @@ -1,11 +1,16 @@ +{% load i18n %} +{% trans "No items to select." as no_items %} +  <div class="form-group">      {% if field.label %}          <label class="col-sm-2 control-label {% if style.hide_label %}sr-only{% endif %}">{{ field.label }}</label>      {% endif %}      <div class="col-sm-10"> -        <select multiple class="form-control" name="{{ field.name }}"> +        <select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">              {% for key, text in field.choices.items %} -            <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> +                <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> +            {% empty %} +                <option>{{ no_items }}</option>              {% endfor %}          </select>          {% if field.errors %} diff --git a/rest_framework/templates/rest_framework/inline/select_multiple.html b/rest_framework/templates/rest_framework/inline/select_multiple.html index feddf7ab..5a8b2494 100644 --- a/rest_framework/templates/rest_framework/inline/select_multiple.html +++ b/rest_framework/templates/rest_framework/inline/select_multiple.html @@ -1,10 +1,15 @@ +{% load i18n %} +{% trans "No items to select." as no_items %} +  <div class="form-group {% if field.errors %}has-error{% endif %}">      {% if field.label %}          <label class="sr-only">{{ field.label }}</label>      {% endif %} -    <select multiple class="form-control" name="{{ field.name }}"> +    <select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">          {% for key, text in field.choices.items %} -        <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> +            <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> +        {% empty %} +            <option>{{ no_items }}</option>          {% endfor %}      </select>  </div> diff --git a/rest_framework/templates/rest_framework/vertical/select_multiple.html b/rest_framework/templates/rest_framework/vertical/select_multiple.html index 54839294..81b25c2a 100644 --- a/rest_framework/templates/rest_framework/vertical/select_multiple.html +++ b/rest_framework/templates/rest_framework/vertical/select_multiple.html @@ -1,10 +1,15 @@ +{% load i18n %} +{% trans "No items to select." as no_items %} +  <div class="form-group {% if field.errors %}has-error{% endif %}">      {% if field.label %}          <label {% if style.hide_label %}class="sr-only"{% endif %}>{{ field.label }}</label>      {% endif %} -    <select multiple class="form-control" name="{{ field.name }}"> +    <select multiple {{ field.choices|yesno:",disabled" }} class="form-control" name="{{ field.name }}">          {% for key, text in field.choices.items %} -        <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> +            <option value="{{ key }}" {% if key in field.value %}selected{% endif %}>{{ text }}</option> +        {% empty %} +            <option>{{ no_items }}</option>          {% endfor %}      </select>      {% if field.errors %} | 
