Code

Opened 7 years ago

Closed 7 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.

Attachments (0)

Change History (2)

comment:1 Changed 7 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 7 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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.