Opened 9 years ago

Closed 9 years ago

#3065 closed defect (fixed)

NewForms RadioSelect render problem

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

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 Changed 9 years ago by adrian

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 Changed 9 years ago by adrian

  • Resolution set to fixed
  • Status changed from new to closed

(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