我有一张 Django 1.8 注册表。我要求用户选择复选框“我已阅读并同意使用条款”。问题出在表格上,标签和 bool 字段复选框位于两行。例如“条款和条件”第一行,复选框和帮助提示 - 第二行。有什么办法可以像这样把所有内容都放在一行中:
条款和条件 [BooleanField] 复选框
表单.py
..... iAgree = forms.BooleanField(label=_("条款&条件"))
addm.html
...
<p>
{{userform.iAgree.label_tag}}
{{userform.iAgree}}
<a title="Please accept that you have read the Terms of Use" href="#" class="helpIcon tooltip"><span title="help"></span></a> </label>
</p>
最佳答案
部分原因可能是您的 HTML。
试一试:
<p>
<label>
{{ userform.iAgree }} {{ userform.iAgree.label }}
</label>
</p>
我不确定您需要 anchor 标记在哪里,但由于它是一个内联元素,您可以轻松地将它放在标签本身旁边。
关于python - Django Booleanfiedl Checkbox 和 Label 显示为两行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41701631/