python - Django Booleanfiedl Checkbox 和 Label 显示为两行

标签 python django checkbox

我有一张 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/

相关文章:

python - 我可以在matplotlib中显示没有科学计数法的图片像素值吗

python - django-nginx-gunicorn - 不工作

python - Raspberry Pi & Arduino 读取串行传感器数据

java - 令人困惑的复选框问题

javascript - 在checkbox的AutoPostBack之前执行js

python - 如何深度复制复制字典列表?

python - Django 使用非数据库字段创建自定义管理 View

python - 为什么当我将光标传递给 StreamingHttpResponse 时,我的光标在生成器函数中已关闭?

python - Django Heroku 应用程序错误。有什么错吗?

html - 并排对齐两组复选框