1
0
mirror of https://github.com/django/django.git synced 2025-10-30 09:06:13 +00:00

Changed BoundField.subwidgets() to return SubWidget objects instead of rendered strings. This means we can access individual radio buttons' properties in the template (see new docs)

git-svn-id: http://code.djangoproject.com/svn/django/trunk@17175 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2011-12-07 23:08:27 +00:00
parent 0920165bc2
commit 08bec4fbc1
4 changed files with 62 additions and 7 deletions

View File

@@ -439,7 +439,7 @@ class FormsTestCase(TestCase):
name = ChoiceField(choices=[('john', 'John'), ('paul', 'Paul'), ('george', 'George'), ('ringo', 'Ringo')], widget=RadioSelect)
f = BeatleForm(auto_id=False)
self.assertEqual('\n'.join(list(f['name'])), """<label><input type="radio" name="name" value="john" /> John</label>
self.assertEqual('\n'.join([str(bf) for bf in f['name']]), """<label><input type="radio" name="name" value="john" /> John</label>
<label><input type="radio" name="name" value="paul" /> Paul</label>
<label><input type="radio" name="name" value="george" /> George</label>
<label><input type="radio" name="name" value="ringo" /> Ringo</label>""")
@@ -454,7 +454,7 @@ class FormsTestCase(TestCase):
name = CharField()
f = BeatleForm(auto_id=False)
self.assertEqual('\n'.join(list(f['name'])), u'<input type="text" name="name" />')
self.assertEqual('\n'.join([str(bf) for bf in f['name']]), u'<input type="text" name="name" />')
def test_forms_with_multiple_choice(self):
# MultipleChoiceField is a special case, as its data is required to be a list: