Sindhujit Ganguly
Sindhujit Ganguly

Reputation: 41

Django-bootstrap3 error "should contain a valid Django Form"

I was learning the basics of django-bootstrap3. I am getting this error when I run the code:

Parameter "form" should contain a valid Django Form.

My code snippet is as follows:

{% 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 between the meaning of form action and {% bootstrap_form myForm %}

Upvotes: 4

Views: 3520

Answers (1)

kartikmaji
kartikmaji

Reputation: 966

action in your form defines the url where it will be directed once you click on submit button. i.e. in your example, once you click submit button, it will be directed to "/detail.html/myForm" with a POST request. And the view handling this url will respond accordingly.

Whereas, your {% bootstrap_form myForm %} will load the your form in your template.

Upvotes: 1

Related Questions