2013-07-08 98 views
0

我摆弄Django窗体和Django Crispy Forms(使用Bootstrap作为我的主题)。我定义了两个领域:Django BooleanField不显示标签

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 

谢谢!

+0

这就是你在找什么:http://stackoverflow.com/a/2045308/1628832 – karthikr

+0

我看了这个例子,但我不知道如何使它与Crispy Forms一起工作,因为我的模板只是包含以下内容:{%block content%} {%crispy form%} {%endblock%} – user2406467

回答

0

我结束了使用自定义模板的某些领域,如:

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

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