Hi Allen,

The RadioSelect widget is actually one of the more complicated ones in
newforms. Its render method returns a RadioFieldRenderer object, which
in turn utilizes the RadioInput widget. The problem with using a
RadioSelect widget in newforms-admin is that the template is expecting
each widget to produce a unicode string, not a non-string object. So
when the RadioSelect widget returns a RadioFieldRenderer object to the
template, an error is triggered.

Luckily, this problem is easy to fix by subclassing RadioSelect like
so:

class AdminRadioSelect(forms.widgets.RadioSelect):
        def render(self, name, value, attrs=None, choices=()):
                renderer =
super(AdminRadioSelect,self).render(name,value,attrs,choices)
                return renderer.__unicode__()

This, of course, is pretty hackish. I am not sure if a ticket is open
to solve this problem. But at least this code suffices for now.

As for initial values ... are you referring to the values of a saved
object as rendered on a change form, or the default values (as defined
in the model) on the add form?

Leif



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to