【发布时间】:2019-05-17 13:16:39
【问题描述】:
我将在表单上有一百多个复选框。这现在看起来很难看。我正在尝试使复选框位于带有垂直滚动条的框架(?)中。以酥脆的形式使用height:100px; 根本没有任何影响。在 attrto CheckboxSelectMultiple() 或 ModelMultipleChoiceField 中使用相同的内容会引发 unexpected argument attr 错误。
表单域:
specialities = forms.ModelMultipleChoiceField( queryset=spQry ,widget = forms.widgets.CheckboxSelectMultiple(), label=_('Speciality'), required=True)
脆弱的形状部分:
self.helper = FormHelper()
self.helper.layout = Layout(
Field('practice_date'),
Field('gender'),
Field('specialities', style='max-height:20px!important'),
StrictButton("Submit", name="submit", value="Submit", type='submit' ,css_class='btn btn-action-success')
)
还有那个滚动条吗?
谢谢
【问题讨论】:
-
你能把
style='overflow-y: scroll;'添加到你的html元素吗
标签: django django-crispy-forms