Hi Adi, thanks for your reply! I had just tried the DateField.input_formats, but the problem was that I'm using the date admin widgets. If I specify input_formats like: '%d.%m.%y', I can't use the admin widgets 'cause it insert the date in the format: '%Y-%m-%d' (how you can see in django/contrib/admin/media/js/admin/DateTimeShortcuts.js line 239)...
On Mar 18, 11:53 am, Adi Sieker <a...@sieker.info> wrote: > 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 -~----------~----~----~----~------~----~------~--~---