I need a time field that can be None.
I define the field so that Null is legal in the DB:
time_end = models.TimeField(blank=True, null=True)
The form field is:
time_end = forms.ChoiceField(required=False, choices=END_TIME_CHOICES)
and END_TIME_CHOICES is:
END_TIME_CHOICES = (
(None, 'End Time Unknown'),
(datetime.time(0,0), '12:00 Midnight'),
(datetime.time(0,30), '12:30 AM'),
(datetime.time(1,0), '1:00 AM'),
(datetime.time(1,30), '1:30 AM'),
etc,
)
My question is why does this field give a validation error when None
is selected, saying:
ValidationError at /event/add_event/
Enter a valid time in HH:MM[:ss[.uuuuuu]] format.
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---