I was wondering if you guys could help. I\'m trying to do a simple view where it sends the user to the client creation form, but I keep getting this error:
This is what is happening:
if block is not being entered.form variable is not defined.form variable in the return statement.As to how to fix it, that's really for you to decide. What the fix is depends on what you want your code to do in case the request method is not POST.
You almost certainly want to de-indent this part:
else:
form = AddClientForm()
That is, on the initial GET of the page, use a blank client form, then when the page is POSTed, use the request POST data to fill in the form object.