我想用django創建這個表單;如何使用django複選框顯示覆選框列表?
[ ] parent_checkbox1
[ ] sub_cb1_pcb1 [ ] sub_cb2_pcb1
...
[ ] parent_checkbox10
[ ] sub_cb1_pcb10 [ ] sub_cb2_pcb10
我可以使與父複選框:
parent = forms.MultipleChoiceField(label="Parent",
widget=forms.CheckboxSelectMultiple)
self.fields['parent'].choices = 'list of choices'
但我怎麼能sub_checkboxes添加到父?
你有沒有考慮自定義字段/控件 - 張貼在這裏可能會幫助http://tothinkornottothink.com/post/10815277049/django-forms-i-custom-fields-and-widgets-in-detail – PhoebeB
嗡嗡聲,將調查它,謝謝 –