Question

I have the following HTML segment that I want to translate to django crispy forms:

    <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>

How would I include the tag and

tags? I tried this:

    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>")
                )
            )
        )

But this was giving a SyntaxError: non-keyword arg after keyword arg --> pointing to the line with the HTML field. Is there something wrong including HTML in Div? How do I translate the given piece of HTML?

Was it helpful?

Solution

The error message is quite clear, isn't it?

So for example your inner block should probably look like this (**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'
)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top