【发布时间】:2013-07-06 05:43:09
【问题描述】:
我正在摆弄 Django 表单和 Django Crispy Forms(使用 Bootstrap 作为我的主题)。我定义了两个字段:
test1 = forms.BooleanField(label='Some label here', help_text='help text here')
和
test2 = forms.CharField(label='another label', help_text='more help text')
当我呈现表单时,test2 字段显示如下标签:
another label: <input box>
下面有“更多帮助文本”。
但是,对于test1(BooleanField),标签似乎改变了文本框后显示的值,即
[] 'Some label here'
help text here
有没有办法让它显示得更像:
Some label here []
help text here
谢谢!
【问题讨论】:
-
这就是你要找的东西:stackoverflow.com/a/2045308/1628832
-
我看了那个例子,但我不确定如何使它与 Crispy Forms 一起工作,因为我的模板只包含以下内容:{% block content %} {% crispy form %} { % 端块 %}
标签: django django-forms django-crispy-forms