All pastes #559902 Raw Edit

TerSia

public text v1 · immutable
·published 2007-06-11 23:04 UTC
rendered paste body
in the form class :

    for track in Track.objects.all():
        trackList.append((track.id,track.name))  
    track = forms.CharField(label=_('track'), required=False, widget=forms.SelectMultiple(choices=trackList))


in the search method:

            chosenTracks = []
            for trackId in form.clean_data['track']:
                print trackId
#                 chosenTracks.extend(Track.objects.get(pk=trackId))


HTML :

<li><label><input type="checkbox" name="track" value="3" id="id_track_0" /> Toutes</label></li>
<li><label><input type="checkbox" name="track" value="1" id="id_track_1" /> Informatique et Mathématiques Appliquées</label></li>
<li><label><input checked="checked" type="checkbox" name="track" value="2" id="id_track_2" /> Hydraulique et Mécanique des Fluides</label></li>


server output if I select entry 2:

[
'
2
'
]