In my application I am getting the day, month and year from the user, the three fields are part of a form and are IntegerField
. I do not want to use DateField
because the user has the options to inform:
My idea is, after the user has informed the data, validate them by calling the function valida_data
(created by me):
erro = form.valida_data()
Function valida_data
created in form
:
def valida_data(self):
if self.fields['mes'] == 2 or 4 or 5 or 6:
pass
But there is an error, because I am comparing a IntegerField
with a int()
.
Can you help me set up the day, month, and year validation function? Do you know another way to perform validation?