1👍
✅
You should validate the forms before processing, like form.is_valid()
and return appropriate
page with form and errors if its not valid.
If forms are valid use form.cleaned_data
for posted data rather than request.POST
.
Here is how to use forms Using forms in view
So either you can add process
input field in the form.
Or for this specific instance, you can add a check in your view before processing form as
if request.POST.has_key('process'):
# return error
Source:stackexchange.com