From 8105a4ac5abc9760ac5dea8e567f333feb6f8e2a Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 10 Aug 2016 12:02:33 +0100 Subject: [PATCH 01/14] Resolve form display with ChoiceField, MultipleChoiceField and non-string choices. (#4374) * Add tests for html-form-rendering choice fields * Resolve issues with ChoiceField, MultipleChoiceField and non-string options * Ensure None template comparisons don't match string None --- .../horizontal/checkbox_multiple.html | 6 +- .../rest_framework/horizontal/radio.html | 6 +- .../rest_framework/horizontal/select.html | 4 +- .../horizontal/select_multiple.html | 4 +- .../inline/checkbox_multiple.html | 4 +- .../rest_framework/inline/radio.html | 3 +- .../rest_framework/inline/select.html | 4 +- .../inline/select_multiple.html | 3 +- .../vertical/checkbox_multiple.html | 6 +- .../rest_framework/vertical/radio.html | 5 +- .../rest_framework/vertical/select.html | 4 +- .../vertical/select_multiple.html | 3 +- rest_framework/templatetags/rest_framework.py | 15 ++++ rest_framework/utils/serializer_helpers.py | 2 +- tests/test_renderers.py | 87 +++++++++++++++++++ 15 files changed, 139 insertions(+), 17 deletions(-) diff --git a/rest_framework/templates/rest_framework/horizontal/checkbox_multiple.html b/rest_framework/templates/rest_framework/horizontal/checkbox_multiple.html index f01071297..7c7e57326 100644 --- a/rest_framework/templates/rest_framework/horizontal/checkbox_multiple.html +++ b/rest_framework/templates/rest_framework/horizontal/checkbox_multiple.html @@ -1,3 +1,5 @@ +{% load rest_framework %} +
{% if field.label %}