Re: [Django] #9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible

14 views
Skip to first unread message

Django

unread,
Nov 16, 2011, 1:38:58 PM11/16/11
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: new
Component: Forms | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------
Changes (by skylar.saveland@…):

* ui_ux: => 0
* easy: => 0


Comment:

this comes up all the time for me. I use this nasty widget that I made:
http://skyl.org/log/post/skyl/2011/01/wherein-the-inner-workings-of-the-
deathstarwidget-are-revealed/

--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:11>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Sep 11, 2012, 2:07:52 PM9/11/12
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: new
Component: Forms | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------

Comment (by skyl):

I have been told that this works: http://djangosnippets.org/snippets/2159/

--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:12>

Django

unread,
Apr 13, 2013, 7:59:57 AM4/13/13
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: closed
Component: Forms | Version: 1.0
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------
Changes (by bmispelon):

* status: new => closed
* cc: bmispelon@… (added)
* resolution: => duplicate


Comment:

Unless I'm mistaken, this is a duplicate of #4592.

--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:13>

Django

unread,
May 21, 2015, 4:16:52 PM5/21/15
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: closed
Component: Forms | Version: 1.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------

Comment (by gabn88):

This is my first post here, so sorry if I'm doing it wrong.

I'm trying to iterate over my checkboxes (using Django 1.7.7) where I'm
using an ModelFormSet to generate multiple forms.

My original code is:
{{{
{%if field.name == "repeat_weekday" %}
<td>{{field}}<td>
{% endif %}
}}}

Now I have made:
{{{
{% for choice, choice_label in field.field.widget.choices %}
<td> <input checked={{choice.checked}}
id="id_form-0-repeat_weekday_0" name="form-0-repeat_weekday"
type="checkbox" value="{{ choice }}"> {{choice_label}} </td>
{% endfor %}
}}}

but I don't know how to find the = checked and id and name via the field.

Easier would IMO be to do something like the thing below (and I would say
that would be a genuine fix of the issue in this ticket):

{{{
{% for checkbox, label in field.checkboxes %}
{{ checkbox }} <!-- Renders the checkbox completely
{{ label }} <!-- Renders the label completely
{% endfor %}
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:14>

Django

unread,
May 22, 2015, 2:47:48 AM5/22/15
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: new

Component: Forms | Version: 1.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------
Changes (by gabn88):

* status: closed => new
* resolution: duplicate =>


--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:15>

Django

unread,
May 22, 2015, 3:14:36 AM5/22/15
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: closed
Component: Forms | Version: 1.0
Severity: Normal | Resolution: duplicate

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------
Changes (by bmispelon):

* status: new => closed

* resolution: => duplicate


Comment:

Hi,

The best place to go for questions like these would rather be the django-
users mailing list: https://groups.google.com/forum/#!forum/django-users.

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:16>

Django

unread,
May 22, 2015, 3:26:59 AM5/22/15
to django-...@googlegroups.com
#9230: Iterating over checkboxes in CheckboxSelectMultiple should be possible
-----------------------------+---------------------------------------
Reporter: mtredinnick | Owner: mtredinnick
Type: New feature | Status: closed
Component: Forms | Version: 1.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-----------------------------+---------------------------------------

Comment (by Claude Paroz <claude@…>):

In [changeset:"97e1160be51e4dfdf35e6ba9d93eff5a52bccbe3" 97e1160]:
{{{
#!CommitTicketReference repository=""
revision="97e1160be51e4dfdf35e6ba9d93eff5a52bccbe3"
Refs #9230 -- Added complementary tests for widget iterations
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/9230#comment:17>

Reply all
Reply to author
Forward
0 new messages