[Answer]-Django "if request.method == 'POST':" fails

1👍

Problem solved:

<script src="{{STATIC_URL}}js/plugins/jqBootstrapValidation.js"></script>

from jqBootstrapValidation caused the problem. I’m not very sure why but there must have been some interference with some form functionalities.

Anyway thanks for your help

0👍

You have an error in your template code: { form.as_p }} add ‘{‘

0👍

I tried the following:

If the form field is

your_name = forms.CharField(label='Your name', max_length=5, required = True)

and I just hit the Submit button without filling in a name, nothing happens. No reload page, no error messages (as the field is set to “required”).

If instead I define the field as

your_name = forms.CharField(widget=forms.TextInput(attrs=dict(required=True, max_length=30)), label=("our name"))

and I hit Submit without name I do get an Django form field error

Leave a comment