From fdd811ec53b3bdc46a2c934422066e1aa9f9dd05 Mon Sep 17 00:00:00 2001 From: Aider Ibragimov Date: Wed, 4 Mar 2015 08:22:46 +0300 Subject: [PATCH 01/54] Allow blank/null on radio.html choices --- .../rest_framework/horizontal/radio.html | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rest_framework/templates/rest_framework/horizontal/radio.html b/rest_framework/templates/rest_framework/horizontal/radio.html index 52238bb1a..efca2883e 100644 --- a/rest_framework/templates/rest_framework/horizontal/radio.html +++ b/rest_framework/templates/rest_framework/horizontal/radio.html @@ -1,20 +1,36 @@ +{% load i18n %} +
{% if field.label %} {% endif %}
{% if style.inline %} + {% if field.allow_null or field.allow_blank %} + + {% endif %} {% for key, text in field.choices.items %} {% endfor %} {% else %} + {% if field.allow_null or field.allow_blank %} +
+ +
+ {% endif %} {% for key, text in field.choices.items %}
From 7159b31023640b8821131e39a7f9eaadfacb2f07 Mon Sep 17 00:00:00 2001 From: Aider Ibragimov Date: Sat, 7 Mar 2015 07:17:22 +0300 Subject: [PATCH 02/54] update vertical and inline layouts for radio choices --- .../rest_framework/horizontal/radio.html | 5 +++-- .../templates/rest_framework/inline/radio.html | 11 +++++++++++ .../rest_framework/vertical/radio.html | 17 +++++++++++++++++ 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 efca2883e..cabd09d2b 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 %}
{% if field.label %} @@ -9,7 +10,7 @@ {% if field.allow_null or field.allow_blank %} {% endif %} {% for key, text in field.choices.items %} @@ -23,7 +24,7 @@
{% endif %} diff --git a/rest_framework/templates/rest_framework/inline/radio.html b/rest_framework/templates/rest_framework/inline/radio.html index 1915f4f84..b65016715 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 %} +
{% if field.label %} {% endif %} + {% if field.allow_null or field.allow_blank %} +
+ +
+ {% endif %} {% for key, text in field.choices.items %}