Hi,

On 18.03.2009, at 11:43, MarcoS wrote:

>
> Hi all,
> I'm implementing a form in django with a DateField field in forms.py.
> My purpose is to allow a user to insert a date in european format (dd/
> mm/yyyy) and then, obviously, convert it in the yyyy/mm/dd format to
> let's django check if it's a valid date and save it in a db.
>
> currently I've a javascript code that intercept the "submit command"
> in the html form and converts the date in yyyy/mm/dd.
>
> My ask is: It's possible to implement the convertion, not in a
> javascript function, but directly in views.py or forms.py before
> cleaning the date?

check the DateField form widget. It allows you to specify what format  
the date should be in.

http://docs.djangoproject.com/en/dev/ref/forms/fields/#datefield

adi

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to