How to loop over form field choices and display associated model instance fields

前端 未结 8 839
广开言路
广开言路 2021-02-02 14:44

I have a ModelForm with a multiple choice field. The choices are populated instances of Hikers belonging to a specific Club.

I want to customize the way my form displays

8条回答
  •  无人共我
    2021-02-02 15:32

    I think, you can define own widget class inherited from CheckboxSelectMultiple with your own render() method and customize html output. See source code, line 690

    It'll be reusable in any template as well.

提交回复
热议问题