Ahhh finally now I know what is happening:

MIDDLEWARE_CLASSES = (
    ...
    'django.middleware.locale.LocaleMiddleware',
)
It seems as soon as the LocaleMiddleware is loaded, Django gets the 
settings frommy  browser session, Hence the dateformat is changed to 
European reflect my location. Clever.
Now that the date input is accepted in American dateformat.
Within the template I get // <http://127.0.0.1:8000/contact/1/call/delete/1> Aug. 31, 2012, which is also correct.
However in the forms, once I try to modify the record I get 2012-08-31

That doesn't seem right. Sure I could use the field format, but isn't that hardcoded and bad practice?
How do you guys in US do that?

Thanks,





On 13/08/12 10:48, Houmie wrote:
Hello everyone,

For some reason the American date format is not accepted in my form. I wonder if any Django developer from US could help me with this. I suspect the timezone in the settings also affect the date format, but I am not sure.
*Settings:*

|TIME_ZONE=  'Europe/London'
LANGUAGE_CODE=  'en-us'
USE_I18N=  True
USE_L10N=  True
USE_TZ=  True

|

*ModelForm:*

|class CallsForm(ModelForm): class Meta: model= Conversation widgets= {
                     'contact_date':  forms.DateInput(attrs={'placeholder':  
'Add the date...',  'id':  'datepicker',  'class':  'placeholder_fix_css'},  
format='%m/%d/%Y'),
                    }
|

enter image description here

Any idea why the American Dateformat still isn't accepted?

Many Thanks,
Houman

--
You received this message because you are subscribed to the Google Groups "Django users" group. To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/uuMUxpVhbx4J.
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.
--
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