combine date time field taking from user and give validation

try:
date = cleaned_data.get('date')
except:
date = ''
if not date:
msg = "Please fill up all mandatory fields"
self._errors['date'] = self.error_class([msg])
return self.cleaned_data

try:
time = cleaned_data.get('time')
print "time",time
except:
time = ''
if not time:
msg = "Please fill up all mandatory fields"
self._errors['time'] = self.error_class([msg])
return self.cleaned_data

b=datetime.combine(date,time)
print b
# try:
# date = self.cleaned_data['date']
# print "date",date
# except:
# date=''
# if date < datetime.date.today() and time < datetime.time.today():
# msg = "The date cannot be in the past!"
# self._errors['date'] = self.error_class([msg])
# return self.cleaned_data

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a6d1bac3-99d4-491d-b177-7578a054279c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to