2013-07-08 97 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,我可以指定我想要的順序。