Thanks Melvyn for the example.

Interesting you get the same problem with American date output as I. So its on purpose to pick the first available input-format from formats.py. Which is very odd if you ask me. I was expecting this to be culture specific too.

Ok, let see how we can fix this. Thanks for the link, yes I could override DATETIME_INPUT_FORMATS within a custom-formats.py

mysite/
    formats/
        __init__.py
        en/
            __init__.py
            formats.py


But looking at this example, 'en/' is not good enough. British English is also `en` but the date format is European. You know what I mean? Again the culture seems to be forgotten :( Unless I could define the path as en-GB/ and it would still be recognized....




On 13/08/12 14:49, Melvyn Sopacua wrote:
from django.utils.translation import activate
activate('en-us')
print form
...
<input type="text" name="registered" value="2012-08-13"
id="id_registered" />
...
activate('nl_NL')
print form
...
<input type="text" name="registered" value="13-08-2012"
id="id_registered" />
...

The reason is in django/conf/locale/en/formats.py. Localize uses the
first *_INPUT format available, which happens to be:
DATE_INPUT_FORMATS = (
     '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006',
'10/25/06'

So if you want a different input format, you'll need to override this as
described at:
<https://docs.djangoproject.com/en/1.4/topics/i18n/formatting/#creating-custom-format-files>

--
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