Opened 18 years ago

Closed 18 years ago

#3065 closed defect (fixed)

NewForms RadioSelect render problem

Reported by: Derek Hoy <django@…> Owned by: Adrian Holovaty
Component: Core (Other) Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using a RadioSelect in a form, it fails to render.
Test code below (tested in r4105):

from django.newforms import *

class TestForm(Form):
    
    url = CharField(max_length=100, required=False)
    test_field1 = ChoiceField(choices=(('1', '1'), ('2', '2')))
    test_field2 = ChoiceField(choices=(('1', '1'), ('2', '2')), widget=RadioSelect())

t = TestForm()

print t['url']
print t['test_field1']
print t['test_field2']

gives an error on the last line:
TypeError: str returned non-string (type RadioFieldRenderer)

Wrapping the return value of widgets.py RadioSelect.render() in str() fixes.

Change History (2)

comment:1 by Adrian Holovaty, 18 years ago

Thanks for reporting this. For the record, wrapping that value in str() is *not* the correct solution. I'm working on the fix.

comment:2 by Adrian Holovaty, 18 years ago

Resolution: fixed
Status: newclosed

(In [4106]) Fixed #3065 -- newforms: Fixed rendering problem with RadioSelect as a member of a Form. Also fixed some Unicode issues and added unit tests. Thanks for reporting, Derek Hoy

Note: See TracTickets for help on using tickets.
Back to Top