Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameter "form" should contain a valid Django Form. #5

Open
seanmavley opened this issue Apr 8, 2017 · 2 comments
Open

Parameter "form" should contain a valid Django Form. #5

seanmavley opened this issue Apr 8, 2017 · 2 comments

Comments

@seanmavley
Copy link

Here's something I have:

<form action="." method="POST" enctype="multipart/form-data">
                  {% csrf_token %}
                  {% bootstrap_form userform %}
                  {{ formset.management_form }}
                  {% bootstrap_form formset %}
                  <div class="form-group">
                    <input type="submit" name="Update" value="Update" class="btn btn-primary" />
                  </div>
</form>

I get the error: Parameter "form" should contain a valid Django Form.. I guess django-bootstrap4 doesn't support formsets, right?

@SJ-palpa
Copy link

Hello,

You should use :

{% bootstrap_formset formset %}

source : https://django-bootstrap4.readthedocs.io/en/latest/templatetags.html#bootstrap-formset

Cordially

@christenvie
Copy link

The issue is with the context you are passing

when you are rendering the view in the views.py there needs to be a context with a form as a dictionary such as this

context = {'form':form}
return render(request, 'learning_logs/upgrade.html', context)

without a context there will be no form passed to the function handling the request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants