0

私は Django フォームと Django Crispy Forms (テーマとして Bootstrap を使用) をいじっています。2 つのフィールドを定義しました。

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

ありがとう!

4

1 に答える 1

0

次のような特定のフィールドにカスタム テンプレートを使用することになりました。

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

my_field_template.html では、希望する順序を指定できました。

于 2013-07-08T22:28:46.547 に答える