Reputation: 1694
When using FormHelper and calling the Form with {% crispy form %}
it delivers a Form enclosed within <form>
tags.
However, my Template is divided into two columns.
First column holds the generated {% crispy form %}
.
Second column holds a hard-coded form. All entries are from the same model. First column is more "dynamic", second column is more "fixed".
I would like to be able to save both forms (both columns) at the same time, suggestively by putting both forms within the same <form>
tags, such as below:
<form method="post">
{% csrf_token %}
{% block col8_content %}
{% crispy form %}
{% endblock col8_content %}
{% block col4_content %}
<div class="form-group row">
...
</div>
<input type="submit" value="Submit">
{% endblock col4_content %}
</form>
Q: Is there a way to combine the ability to easily create forms programmatically (FormHelper) together with manual elements?
Upvotes: 0
Views: 53
Reputation: 1412
Set
self.helper.form_tag = False
You may then manually add an opening and closing form
tags at the desired place.
It specifies if tags should be rendered when using a Layout. If set to False it renders the form without the tags. Defaults to True.
See https://django-crispy-forms.readthedocs.io/en/latest/form_helper.html
Upvotes: 1