From a834bc84d8c76d4a7016ac4db4f631a8bcaa3d0b Mon Sep 17 00:00:00 2001 From: Christopher Babiak Date: Thu, 26 Sep 2013 08:28:26 -0700 Subject: Fixed #20931 -- Fixed select widgets nested choice rendering ChoiceFieldRenderer was not rendering nested choices. Added recursion to ChoiceFieldRenderer to take nested choices and render them as """) + + def test_nested_choices(self): + # Choices can be nested for radio buttons: + w = RadioSelect() + w.choices=(('unknown', 'Unknown'), ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))), ('Video', (('vhs', 'VHS'), ('dvd', 'DVD')))) + self.assertHTMLEqual(w.render('nestchoice', 'dvd', attrs={'id':'media'}), """""") + + # Choices can be nested for checkboxes: + w = CheckboxSelectMultiple() + w.choices=(('unknown', 'Unknown'), ('Audio', (('vinyl', 'Vinyl'), ('cd', 'CD'))), ('Video', (('vhs', 'VHS'), ('dvd', 'DVD')))) + self.assertHTMLEqual(w.render('nestchoice', ('vinyl', 'dvd'), attrs={'id':'media'}), """""") def test_checkboxselectmultiple(self): -- cgit v1.3