diff options
| author | Aider Ibragimov | 2015-03-07 07:17:22 +0300 | 
|---|---|---|
| committer | Aider Ibragimov | 2015-03-07 07:17:22 +0300 | 
| commit | 7159b31023640b8821131e39a7f9eaadfacb2f07 (patch) | |
| tree | 2a94d9729680294b68da830429436f4c6abf321f /rest_framework | |
| parent | fdd811ec53b3bdc46a2c934422066e1aa9f9dd05 (diff) | |
| download | django-rest-framework-7159b31023640b8821131e39a7f9eaadfacb2f07.tar.bz2 | |
update vertical and inline layouts for radio choices
Diffstat (limited to 'rest_framework')
3 files changed, 31 insertions, 2 deletions
| diff --git a/rest_framework/templates/rest_framework/horizontal/radio.html b/rest_framework/templates/rest_framework/horizontal/radio.html index efca2883..cabd09d2 100644 --- a/rest_framework/templates/rest_framework/horizontal/radio.html +++ b/rest_framework/templates/rest_framework/horizontal/radio.html @@ -1,4 +1,5 @@  {% load i18n %} +{% trans "None" as none_choice %}  <div class="form-group">      {% if field.label %} @@ -9,7 +10,7 @@          {% if field.allow_null or field.allow_blank %}              <label class="radio-inline">                  <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> -                {% trans "None" %} +                {{ none_choice }}              </label>          {% endif %}          {% for key, text in field.choices.items %} @@ -23,7 +24,7 @@              <div class="radio">                  <label>                      <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> -                    {% trans "None" %} +                    {{ none_choice }}                  </label>              </div>          {% endif %} diff --git a/rest_framework/templates/rest_framework/inline/radio.html b/rest_framework/templates/rest_framework/inline/radio.html index 1915f4f8..b6501671 100644 --- a/rest_framework/templates/rest_framework/inline/radio.html +++ b/rest_framework/templates/rest_framework/inline/radio.html @@ -1,7 +1,18 @@ +{% load i18n %} +{% trans "None" as none_choice %} +  <div class="form-group {% if field.errors %}has-error{% endif %}">      {% if field.label %}          <label class="sr-only">{{ field.label }}</label>      {% endif %} +    {% if field.allow_null or field.allow_blank %} +        <div class="radio"> +            <label> +                <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %}> +                {{ none_choice }} +            </label> +        </div> +    {% endif %}      {% for key, text in field.choices.items %}          <div class="radio">              <label> diff --git a/rest_framework/templates/rest_framework/vertical/radio.html b/rest_framework/templates/rest_framework/vertical/radio.html index ed9f9ddb..dea03e54 100644 --- a/rest_framework/templates/rest_framework/vertical/radio.html +++ b/rest_framework/templates/rest_framework/vertical/radio.html @@ -1,9 +1,18 @@ +{% load i18n %} +{% trans "None" as none_choice %} +  <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 %}      {% if style.inline %}          <div> +        {% if field.allow_null or field.allow_blank %} +            <label class="radio-inline"> +                <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> +                {{ none_choice }} +            </label> +        {% endif %}          {% for key, text in field.choices.items %}              <label class="radio-inline">                  <input type="radio" name="{{ field.name }}" value="{{ key }}" {% if key == field.value %}checked{% endif %}> @@ -12,6 +21,14 @@          {% endfor %}          </div>      {% else %} +        {% if field.allow_null or field.allow_blank %} +            <div class="radio"> +                <label> +                    <input type="radio" name="{{ field.name }}" value="" {% if not field.value %}checked{% endif %} /> +                    {{ none_choice }} +                </label> +            </div> +        {% endif %}          {% for key, text in field.choices.items %}              <div class="radio">                  <label> | 
