Opened 9 years ago

Closed 7 years ago

#6458 closed (duplicate)

Make BoundField with RadioSelect widget iterable

Reported by: oyvind Owned by: nobody
Component: Forms Version: master
Severity: Keywords: newforms radioselect boudfield
Cc: cmawebsite@…, amlau@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Would allow

{{ form.boundradiofield.0.choice_label }} {{ form.boundradiofield.0.tag }} possible in the tamplate

See tests for example

Attachments (2)

make_radioselect_iterable.diff (3.3 KB) - added by oyvind 9 years ago.
make_radioselect_iterable2.diff (3.7 KB) - added by J. Pablo Fernández <pupeno@…> 8 years ago.
This patch solves the issue in my last comment and also ads value indexing.

Download all attachments as: .zip

Change History (9)

Changed 9 years ago by oyvind

comment:1 Changed 8 years ago by J. Pablo Fernández <pupeno@…>

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

Hello,

In this method:

    def __iter__(self):
        data, attrs = self.get_data_and_attrs(widget, attrs)
        for i in self.field.widget.iter(self.html_name, data, attrs=attrs):
            yield i

where are the initial widget and attrs supposed to come from?

Changed 8 years ago by J. Pablo Fernández <pupeno@…>

This patch solves the issue in my last comment and also ads value indexing.

comment:2 Changed 8 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:3 Changed 8 years ago by Jacob

Needs documentation: set

comment:4 Changed 8 years ago by Collin Anderson

This is somewhat of a separate issue, but I would like to see a boundfield.get_data() method and a separate bountfield.get_widget_and_attrs() method.

comment:5 Changed 8 years ago by Collin Anderson

Cc: cmawebsite@… added

comment:6 Changed 8 years ago by

Cc: amlau@… added

comment:7 Changed 7 years ago by Chris Beaven

Resolution: duplicate
Status: newclosed

Marking as a dupe of the more recently patched in #9230

Note: See TracTickets for help on using tickets.
Back to Top