> I need some support with something, i have the following boolean field
> but if you submit the form without choosing an answer it kicks back an
> error because i have the following IF Statment to make sure when it is
> selected other fields are mandatory. HEres the code.
Instead of this line:
if request.POST['Lived_Out_Uk'] == '1':
Use this:
if 'Lived_Out_Uk' in request.POST:
Regards,
Wayne Koorts
http://www.wkoorts.com
Also, look up the `in` operator for future references. But not for
this case, because I think you're doing it wrong.
Finally, please do read PEP8. Python is not (as far as I know) Ada.
The variable names Lived_Out_Uk, Country_Residence and Date_Reentry
don't conform to most Python style guides, they should be all-
lowercase and underscore-separated words, not titlecased.
But really, you should use django's forms for that kind of things.
Also, please read the Python tutorial at least, it's not a big
document and it'll help you a lot.