Django-bootstrap3 error "must contain a valid Django form"

I've been learning the basics of django-bootstrap3 . I am getting this error when running the code:

The "form" parameter must contain a valid Django form.

My code snippet looks like this:

{% load bootstrap3 %}
<form action="/detail.html/myForm" method="post" class="form">
        {%csrf_token %}
        {% bootstrap_form myForm %}
        {% buttons %}
                <button type="submit" class="btn btn-primary">
                        {% bootstrap_icon "star" %} Submit
                </button>
        {% endbuttons %}
</form>

      

I am confused about the meaning of the form action and {% bootstrap_form myForm %}

+3


source to share


1 answer


the action on your form determines the url where it will be directed to once you hit the submit button. those. in your example, once you click the submit button it will be redirected to "/detail.html/myForm"

with a POST request. And the view that parses this url will respond appropriately.



While yours {% bootstrap_form myForm %}

uploads your form to your template.

+1


source







All Articles