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

Fixed #28176 -- Restored the uncasted option value in ChoiceWidget template context.

This commit is contained in:
Tim Graham
2017-06-15 11:05:21 -04:00
parent dc63ad7ac0
commit 221e6e1817
5 changed files with 16 additions and 3 deletions

View File

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

View File

@@ -1 +1 @@
<option value="{{ widget.value }}"{% include "django/forms/widgets/attrs.html" %}>{{ widget.label }}</option>
<option value="{{ widget.value|stringformat:'s' }}"{% include "django/forms/widgets/attrs.html" %}>{{ widget.label }}</option>

View File

@@ -591,7 +591,7 @@ class ChoiceWidget(Widget):
option_attrs['id'] = self.id_for_label(option_attrs['id'], index)
return {
'name': name,
'value': str(value),
'value': value,
'label': label,
'selected': selected,
'index': index,