Error: Parameter "form" should contain a valid Django Form
See original GitHub issueI followed the example using Parameter Django (2.0) and django-bootstrap3 (9.1.0) and it shows: `
Request Method: | GET |
---|---|
http://127.0.0.1:8000/polls/ | |
2.0 | |
BootstrapError | |
Parameter “form” should contain a valid Django Form. | |
D:\PycharmProjects\mysite\venv\lib\site-packages\bootstrap3\renderers.py in init, line 161 | |
D:\PycharmProjects\mysite\venv\Scripts\python.exe | |
3.5.1 | |
[‘D:\PycharmProjects\mysite’, ‘D:\PycharmProjects\mysite\venv\Scripts\python35.zip’, ‘D:\PycharmProjects\mysite\venv\DLLs’, ‘D:\PycharmProjects\mysite\venv\lib’, ‘D:\PycharmProjects\mysite\venv\Scripts’, ‘C:\Python\Python35\Lib’, ‘C:\Python\Python35\DLLs’, ‘D:\PycharmProjects\mysite\venv’, ‘D:\PycharmProjects\mysite\venv\lib\site-packages’] | |
Sun, 17 Dec 2017 15:35:23 +0800 | |
` | |
following is my code: |
` {% load static %}
{# Load the tag library #} {% load bootstrap3 %}
{# Load CSS and JavaScript #} {% bootstrap_css %} {% bootstrap_javascript %}
{# Display django.contrib.messages as Bootstrap alerts #} {% bootstrap_messages %}
<link rel="stylesheet" type="text/css" href="{% static 'polls/style.css' %}" /> <form action="/url/to/submit/" method="post" class="form"> {% csrf_token %} {% bootstrap_form form %} {% buttons %} <button type="submit" class="btn btn-primary"> {% bootstrap_icon "star" %} Submit </button> {% endbuttons %} </form> `Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
BootstrapError Parameter "form" should contain a valid ...
I would guess this is an error with django-bootstrap using the custom TextArea widget; I added a suggestion for how I would investigate...
Read more >Parameter "form" should contain a valid Django Form-django
Coding example for the question BootstrapError: Parameter "form" should contain a valid Django Form-django.
Read more >Form and field validation
The validate() method on a Field handles field-specific validation that is not suitable for a validator. It takes a value that has been...
Read more >Python – BootstrapError Parameter “form” should contain a ...
Now, the error your seeing is most likely related to you passing request.POST to a form even if request.POST is blank; the form...
Read more >Template tags and filters - django-bootstrap4 - Read the Docs
Render form errors. Tag name: bootstrap_form_errors. Parameters: form The form that is to be rendered type Control which type of errors should be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.