Hi, I need to implement a MultiValueField that contains a
HiddenField() and a ChoiceField(widget=RadioSelect()), but I can't
create a MultiWidget that contains a RadioSelect because render()
doesn't return a string for a RadioSelect, it returns a
RadioFieldRenderer.

if I overload render and change this line:
output.append(widget.render(name + '_%s' % i, widget_value, attrs))
with this one:
output.append(str(widget.render(name + '_%s' % i, widget_value,
attrs)))
it works.

is there another way to do this?

thanks in advance

here is the code, just in case you want to see it:

from django import newforms as forms

class Pregunta
    def __init__(self, id_pregunta, id_respuesta):
        self.id_pregunta = id_pregunta
        self.id_respuesta = id_respuesta

class PreguntaWidget(forms.MultiWidget):
    def __init__(self, attrs=None):
        widgets = (forms.HiddenInput(), forms.RadioSelect())
        super(PreguntaWidget, self).__init__(widgets, attrs)

    def decompress(self, value):
        if value:
            return [value.id_pregunta, value.id_respuesta]
        return [None, None]


--~--~---------~--~----~------------~-------~--~----~
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