I am creating a Django (1.6) website (with twitter bootstrap) that has some forms where the user has to fill out several dates. I have included l10n and i18n. Datetime fields are controlled by jQuery widgets. The widget accepts a parameter to determine the input format for the date and time. How can I get the current django datetime format in a template tag so that I can match it with the Javascript equivalent? I want to get the full language (e.g. nl_BE, en_US, ...) because I live in Belgium and we play in French, Dutch and German, but we all use the same date format. If I use only the language (with get_language from django.utils.translation), I see date formats from France and Germany.
>>> from django.utils import formats >>> formats.get_format("SHORT_DATE_FORMAT", lang="nl") Out[27]: u'j-nY' >>> formats.get_format("SHORT_DATE_FORMAT", lang="fr") Out[28]: u'j NY' >>> formats.get_format("SHORT_DATE_FORMAT", lang="de") Out[29]: u'd.mY'
I checked already Django-datetime-widget on my demo page, but if I switch my browser (chrome) to Dutch or French, it will not change the date format ...
Anyone have an idea to solve this?
Wimdh source share