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

[1.11.x] Fixed #28176 -- Restored the uncasted option value in ChoiceWidget template context.

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

View File

@@ -351,6 +351,12 @@ class SelectTest(WidgetTest):
)
self.assertEqual(index, 2)
def test_optgroups_integer_choices(self):
"""The option 'value' is the same type as what's in `choices`."""
groups = list(self.widget(choices=[[0, 'choice text']]).optgroups('name', ['vhs']))
label, options, index = groups[0]
self.assertEqual(options[0]['value'], 0)
def test_deepcopy(self):
"""
__deepcopy__() should copy all attributes properly (#25085).