1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #27920 -- Restored empty RadioSelect choice producing value=""

Regression in b52c73008a.
Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz
2017-03-09 15:42:47 +01:00
parent a7ec7afce1
commit 540ae68a5c
6 changed files with 15 additions and 10 deletions

View File

@@ -1 +1 @@
<input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None and widget.value != "" %} value="{{ widget.value }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
<input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />

View File

@@ -1 +1 @@
<input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None and widget.value != "" %} value="{{ widget.value }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />
<input type="{{ widget.type }}" name="{{ widget.name }}"{% if widget.value != None %} value="{{ widget.value }}"{% endif %}{% include "django/forms/widgets/attrs.html" %} />

View File

@@ -180,8 +180,8 @@ class Widget(metaclass=MediaDefiningClass):
"""
Return a value as it should appear when rendered in a template.
"""
if value is None:
value = ''
if value == '' or value is None:
return None
if self.is_localized:
return formats.localize_input(value)
return force_text(value)