Hi Carlton, I want to use YEAR_FORMAT in the template the same why I'm using DATE_FORMAT and MONTH_DAY_FORMAT:
{% if can_view_profile and user.date_of_birth %} {% if can_view_dob_day_month or can_view_dob_year %} <tr> <th nowrap="nowrap">{% 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:"DATE_FORMAT" }} {% elif can_view_dob_day_month %} {{ user.date_of_birth|date:"MONTH_DAY_FORMAT" }} {% elif can_view_dob_year %} {{ user.date_of_birth|date:"YEAR_FORMAT" }} {% endif %} </td> </tr> {% endif %} {% endif %} And to be able to customize YEAR_FORMAT for specific locales if it needs to be customized. But not to define it if it's equal to the default value which I defined. Does Custom Format Files do it? I'm going to try to implement the patch on Speedy Net right now without having to update 14 files. There is a suggestion on Stack Overflow. אורי u...@speedy.net On Mon, Dec 2, 2019 at 6:07 PM Carlton Gibson <carlton.gib...@gmail.com> wrote: > Well not currently no. 😀 > > What I’m trying to ask is why you want to do this? What does you code look > like without it? > > Those formats are used by Django. Why would you want/need to put your own > values in the same place? > > get_format() returns what you pass it if your format is not found, yes? So > is a wrapper function, to fetch your default in that case, not sufficient? > > If not, why not? And even if it is maybe a change Is still in order. Is > that the improvement you’re suggesting? > > And so on... > > But that’s not the same topic as overriding the original values, for which > custom format files does serve I think. > > Again, sorry if I’m not quick enough for you. Just trying to get clear? > > On Mon, 2 Dec 2019 at 16:58, אורי <u...@speedy.net> wrote: > >> Hi Carlton, >> >> The list of formats on >> https://github.com/django/django/blob/master/django/utils/formats.py#L31-L46 >> is: >> >> FORMAT_SETTINGS = frozenset([ >> 'DECIMAL_SEPARATOR', >> 'THOUSAND_SEPARATOR', >> 'NUMBER_GROUPING', >> 'FIRST_DAY_OF_WEEK', >> 'MONTH_DAY_FORMAT', >> 'TIME_FORMAT', >> 'DATE_FORMAT', >> 'DATETIME_FORMAT', >> 'SHORT_DATE_FORMAT', >> 'SHORT_DATETIME_FORMAT', >> 'YEAR_MONTH_FORMAT', >> 'DATE_INPUT_FORMATS', >> 'TIME_INPUT_FORMATS', >> 'DATETIME_INPUT_FORMATS', >> ]) >> >> Is there a way to extend it and add more values? >> >> אורי >> u...@speedy.net >> >> >> On Mon, Dec 2, 2019 at 5:35 PM Carlton Gibson <carlton.gib...@gmail.com> >> wrote: >> >>> Hi Uri. >>> >>> On Monday, 2 December 2019 16:19:11 UTC+1, Uri wrote: >>>> >>>> I don't understand how this is related to Custom Format Files. >>>> >>> >>> Well in the SO post you linked you say this: >>> >>> > 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. >>> >>> In the docs I linked you to it says this: >>> >>> > Django provides format definitions for many locales, but sometimes you >>> might want to create your own, because a format files doesn’t exist for >>> your locale, or because you want to overwrite some of the values. >>> >>> So that looks exactly like what you need. >>> >>> No? >>> >>> (Sorry if I've missed your point — it's sometimes hard to see what folks >>> are getting at just from links and commits. 😬) >>> >>> Kind Regards, >>> >>> Carlton >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Django developers (Contributions to Django itself)" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to django-developers+unsubscr...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-developers/364d0c49-2c1b-44ea-819c-6aedc5a6b0bc%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-developers/364d0c49-2c1b-44ea-819c-6aedc5a6b0bc%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django developers (Contributions to Django itself)" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-developers+unsubscr...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-developers/CABD5YeEDUjpzxgEwUh%3D%2BFsKjvD8Wx6s1S%2B-HY2nfmFo_WUv2KA%40mail.gmail.com >> <https://groups.google.com/d/msgid/django-developers/CABD5YeEDUjpzxgEwUh%3D%2BFsKjvD8Wx6s1S%2B-HY2nfmFo_WUv2KA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > You received this message because you are subscribed to the Google Groups > "Django developers (Contributions to Django itself)" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-developers+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-developers/CAJwKpyQV9x%2Ba9tbYx%3DKQrxCyuH7RD06-bmn03tUhEu_Pu5atVw%40mail.gmail.com > <https://groups.google.com/d/msgid/django-developers/CAJwKpyQV9x%2Ba9tbYx%3DKQrxCyuH7RD06-bmn03tUhEu_Pu5atVw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/CABD5YeF5hq-Dseeo0Pbo8UzDE1TkbhfSTO61WERG7Lh7E8WPjA%40mail.gmail.com.