1 form表单如何生成多选框(包含了多选框可选择内容)

    - Form设置班级输入框为 select多选
        - 多选
            class TeacherForm(Form):
                name = fields.CharField(max_length=16,
                                        widget=widgets.TextInput(attrs={'class': 'form-control'})
                                        )
                cls = fields.MultipleChoiceField(
                    choices=models.Classes.objects.values_list('id', 'title'),
                    widget=widgets.SelectMultiple(attrs={'class': 'form-control'})
                )
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-04-18
  • 2021-09-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-13
  • 2021-10-30
  • 2021-11-17
  • 2022-12-23
相关资源
相似解决方案