I have this puzzling django form
Here is part of my views.py handling the POST request
def getUpdataBet(request, name):
elif request.method == 'POST':
Bound_form = form_Net(request.POST, instance=obj)
new_tag = Bound_form.save()
return render(request, 'Account\Sucess.html', .........)
And my forms.py has this custom cleaning for the form page.
Data = self.cleaned_data.get(BetAccountBalance)
If Data > 800:
raise forms.ValidationError("Value too Large")
My question is that, In my form page when i give a value greater than 800, it returns the validation error as usual. But when i input a value lesser than 800, the form page acts as bound_form.is_valid() is false
The most puzzling thing is that when i comment out the if and else statement, it works perfectly fine and returns the cleaned_data perfectly. Is it that you dont use an if statement in a custom clean method.?