Opened 7 years ago

Closed 5 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 7 years ago.
make_radioselect_iterable2.diff (3.7 KB) - added by J. Pablo Fernández <pupeno@…> 7 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 7 years ago by oyvind

comment:1 Changed 7 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 7 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 7 years ago by jacob

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 7 years ago by jacob

  • Needs documentation set

comment:4 Changed 7 years ago by CollinAnderson

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 7 years ago by CollinAnderson

  • Cc cmawebsite@… added

comment:6 Changed 7 years ago by amlau

  • Cc amlau@… added

comment:7 Changed 5 years ago by SmileyChris

  • Resolution set to duplicate
  • Status changed from new to closed

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

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