In the input field user enters date and time, together like this
format: 03/17/2007 05:11 PM
If I do enter it like this, I get a validation error as follows:
03/17/2007 05:11 PM *** Enter a valid date/time.
I have following code in my forms.py and tempalte add.html:
forms.py
start_at = forms.DateTimeField(label='Start At',
required = True
)
add.html
<p>
<label for="id_start_at">Start At:</label> {{ form.start_at }}
{% if form.start_at.errors %}*** {{ form.start_at.errors|join:",
" }}{% endif %}
</p>
I try to run it and see what format python deals with for datatime, it
gives out in this format: (yyyy, mm, dd, hh, mm, ss, microsecond)
In python shell the datetime format look like this
>>> import datetime
>>> datetime.datetime.now()
datetime.datetime(2007, 3, 17, 17, 23, 50, 578000)
>>>
How can I fix it so it takes the input the way user enters: 03/17/2007
05:11 PM ?
Thank you.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---