I am using django modelforms and formsets. But the problem I am facing is that when the form is not validated, instead of showing the erros on the html page it gives and error in the view.
View `
def create(request):
if request.method=="POST":
foo= fooform(request.POST,prefix="fooform")
if foo.valid():
#do stuff
else:
foo= fooform(prefix="fooform")
return render(request,'property/create.html',{'foo':foo})
`
Problem:
When the form does not validate there is a obvious error in the view where in it unable to find the fooform. I want the html page to show the error-ed fields. What am I doing wrong?
Edit:
I think I have found the main issue. The issue is that the modelform is not applying its form validations at the browser level. Because of this the form is getting submitted even though it is not valid. As a result it is failing the validation and not finding the else part.