作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有以下 HTML 片段,我想将其翻译成 Django 脆皮形式:
<div class="span5">
<h3 class='offset1'>Select images</h3>
<div id='image-drop' class='dropzone span5 center'>
<p>Drag and drop photos and video here</p>
<p class='big'>+</p>
<p>Or click to add using the file browser</p>
</div>
</div>
我将如何包含标签和
标签?我试过这个:
self.helper.layout = Layout(
Div(css_class='span5',
HTML("<h3 class='offset1'>Select Images</h3>"),
Div(css_id='image-drop',
css_class='dropzone span5 center',
HTML("<p>Drag and drop photos and video here</p><p class='big'>+</p><p>Or click to add using the file browser</p>")
)
)
)
但这给出了 SyntaxError: non-keyword arg after keyword arg --> pointing to the line with the HTML field。在 Div 中包含 HTML 有什么问题吗?如何翻译给定的 HTML 片段?
最佳答案
错误信息很清楚,不是吗?
因此,例如,您的内部 block 可能看起来像这样 (**args* fist, then ***kwargs*):
Div(
HTML("<p>Drag and drop photos and video here</p><p class='big'>+</p><p>Or click to add using the file browser</p>"),
css_id='image-drop',
css_class='dropzone span5 center'
)
关于django - 如何在 Django Crispy Forms 中包含 HTML 标题标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14266887/
我是一名优秀的程序员,十分优秀!