Mar*_*ark 2 django django-crispy-forms
我有以下 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>
Run Code Online (Sandbox Code Playgroud)
我将如何包含标签和
标签?我试过这个:
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>")
)
)
)
Run Code Online (Sandbox Code Playgroud)
但这给出了一个 SyntaxError: non-keyword arg after keyword arg --> 指向带有 HTML 字段的行。在 Div 中包含 HTML 有什么问题吗?如何翻译给定的 HTML 片段?
错误信息很清楚,不是吗?
因此,例如您的内部块应该看起来像这样(**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'
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1479 次 |
| 最近记录: |