*Update:* I found out that it's possible to override formats per locale in this link <https://docs.djangoproject.com/en/1.11/topics/i18n/formatting/>, and added formats for en and he locales, but they don't work. I added a debugging code which you can see here <https://github.com/speedy-net/speedy-net/blob/uri_main_branch_2019-07-26_c/speedy/core/locale/en/formats.py#L4>, but it doesn't work. It shows dates like Jan. 1, 2018 and not as I expect.
I also don't know if DATE_FORMAT should be preceded by settings. in the template, but it doesn't show anything without it. אורי u...@speedy.net On Wed, Jul 24, 2019 at 8:45 PM אורי <u...@speedy.net> wrote: > Hi, > > We are using Django 1.11 for Speedy Net. I want to override the default > values of DATE_FORMAT and MONTH_DAY_FORMAT in English, but keep the default > values (or define them again) in Hebrew. So they will not be the same and > will not be identical to Django's default values. In English we will have: > > DATE_FORMAT = 'j F Y' > MONTH_DAY_FORMAT = 'j F' > YEAR_FORMAT = 'Y' > > And in Hebrew: > > DATE_FORMAT = 'j בF Y' > MONTH_DAY_FORMAT = 'j בF' > > (and YEAR_FORMAT will be the same). > > The template currently looks like this: > > {% if can_view_profile and user.date_of_birth %} > {% if can_view_dob_day_month or can_view_dob_year %} > <tr> > <th>{% if can_view_dob_day_month %}{% trans 'Birth Date' %}{% > elif can_view_dob_year %}{% trans 'Birth Year' %}{% endif %}</th> > <td> > {% if can_view_dob_day_month and can_view_dob_year %} > {{ user.date_of_birth|date:settings.DATE_FORMAT }} > {% elif can_view_dob_day_month %} > {{ user.date_of_birth|date:settings.MONTH_DAY_FORMAT }} > {% elif can_view_dob_year %} > {{ user.date_of_birth|date:settings.YEAR_FORMAT }} > {% endif %} > </td> > </tr> > {% endif %} > {% endif %} > > And I want it to display the dates in these formats in each language. How > do I do it? > אורי > u...@speedy.net > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CABD5YeFaVPNC1RT3QqTPv7oVyPjSCtZZq_aO7UcHgMr%3DYTm16w%40mail.gmail.com.