gpt4 book ai didi

django - 如何在 Django Crispy Forms 中包含 HTML 标题标签?

转载 作者:行者123 更新时间:2023-12-02 22:17:10 24 4
gpt4 key购买 nike

我有以下 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com