Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Django BooleanField不显示标签_Django_Django Forms_Django Crispy Forms - Fatal编程技术网

Django BooleanField不显示标签

Django BooleanField不显示标签,django,django-forms,django-crispy-forms,Django,Django Forms,Django Crispy Forms,我正在摆弄Django表单和Django Crispy表单(使用Bootstrap作为我的主题)。我定义了两个字段: test1 = forms.BooleanField(label='Some label here', help_text='help text here') 及 呈现表单时,test2字段显示如下标签: another label: <input box> 有没有办法让它显示得更像: Some label here [] help text here 谢谢 我

我正在摆弄Django表单和Django Crispy表单(使用Bootstrap作为我的主题)。我定义了两个字段:

test1 = forms.BooleanField(label='Some label here', help_text='help text here')

呈现表单时,test2字段显示如下标签:

another label: <input box>
有没有办法让它显示得更像:

Some label here []
help text here

谢谢

我最终为某些字段使用了自定义模板,例如:

Field('my_field', template='my_field_template.html')

在我的_field_template.html中,我可以指定我想要的顺序。

这就是你要找的:我看了这个例子,但我不确定如何使它与Crispy表单一起工作,因为我的模板只包含以下内容:{%block content%}{%Crispy form%}{%endblock%}
Some label here []
help text here
Field('my_field', template='my_field_template.html')