If you have a function as below in the SelectForm class you can get a
iterable renderer for the radio button field.I am not very sure about
whether you have a initial  value or value in your situation.

def get_selectfield_renderer(self):
                field = self.fields['selectfield']
                widget =  field.widget
                value = self.initial['selectfield']
                renderer = widget.get_renderer('selectfield', value)
                return renderer

You can then render each radio button choice in the template by using
{{ form.get_selectfield_renderer.0 }}  ,
{{ form.get_selectfield_renderer.1 }} etc.If you are using a for loop
you can use the forloop.counter0

On Aug 7, 4:03 pm, Andreas Pfrengle <a.pfren...@gmail.com> wrote:
> Hello,
>
> what I want to do is to add a radio button into the last column of a
> data table. The user shall be able to select exactly one of the
> table's rows. I was thinking about defining a SelectForm with one
> 'select'-field (ChoiceField) with a RadioSelect-widget. In the
> template, I would then need to iterate over the data (each data row)
> AND each OPTION of the radio select widget.
> How would I do that? Just referring to
> {{ selectform.fields.selectfield.choices }} in the template gives me
> the list of choices (i.e. each single choice when I loop over it), but
> not the html I want.
>
> Are there any other approaches to the problem?
>
> Thanks for your suggestions,
> Andreas

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

Reply via email to