Electronics & Programming


Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » MultipleChoiceField Edit form Error [RSS Feed]

#1 Jan. 24, 2011 20:58:18

Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

MultipleChoiceField Edit form Error

Hello All,

I am having a problem with my MultipleChoiceField. I have my model
field, form field and choices listed below. When I select choices 1-9,
the edit form shows that these choices have been checked (i.e. save
the form, then view the form for editing again, the previously checked
check boxes are checked and this works using CheckboxSelectMultiple or
the standard Multiple Select Widget). However, when I chose choices 10
or 11 (or beyond), the list gets saved to my table field just fine
(), but when I view the form for editing, choice 11
(UK) is not checked.

It appears that when my Choice is a two digit number (in string
format) it saves just fine, but when the html is being rendered for
the form, the checked attribute is not being checked properly for the
last items.

I also tried changing choice 1 to 12 and that broke it, but then
worked when changed back to 1. Everything saves fine in the table, but
is not rendered correctly and the template tag I wrote to display the
selected choices works just fine with those higher number choices.


targetmarkets = models.CharField(max_length=255, blank=True)

('1', 'Europe'),
('2', 'Asia'),
('3', 'North America'),
('4', 'South America'),
('5', 'Africa'),
('6', 'Canada'),
('7', 'USA'),
('8', 'East Europe'),
('9', 'West Europe'),
('10', 'Australasia'),
('11', 'UK'),


targetmarkets = forms.MultipleChoiceField(required=False,
widget=forms.CheckboxSelectMultiple, choices=TARGETMARKETS_CHOICES)

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
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.


Board footer

Moderator control

Enjoy the 13th of December

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support