Hello, but why you configure this with a own class? You can configure this in settings.py...
Regards <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> Virenfrei. www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=webmail> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> Am Mi., 27. Okt. 2021 um 12:43 Uhr schrieb binoy...@gmail.com < binoyuda...@gmail.com>: > Hi > > Sorry, I missed that part. > > class CustomDateInput(forms.DateInput): > input_type = 'date' > format = get_format(forms.DateInput.format_key) + ["%d.%m.%Y"] > > and USE_L10N = True in settings. > > On Wednesday, October 27, 2021 at 12:18:32 PM UTC+2 sebasti...@gmail.com > wrote: > >> Hello, >> >> I think you need a entry in settings.py with USE_L10N = True >> >> You can make fix format in settings.py with DATE_FORMAT = 'd.m.Y' >> >> Regards >> >> binoy...@gmail.com <binoy...@gmail.com> schrieb am Mi., 27. Okt. 2021, >> 11:07: >> >>> Hi >>> I have a form field forms.DateField and widget as follows >>> >>> class CustomDateInput(forms.DateInput): >>> input_type = 'date' >>> >>> valid_from = forms.DateField( >>> label=_("Valid from"), widget=CustomDateInput(), required=False, >>> localize=True) >>> >>> But the date is not displayed by the browser when the language is >>> German(de). The field is rendered as follows with in: >>> >>> <input type="date" name="valid_from" value="25.10.2021" >>> class="form_item" id="id_valid_from"> >>> >>> But the browser is *not display* the initial value to the user, instead >>> shows *mm/dd/yyyy* when the system language is English and *dd.mm.yyyy* >>> when the system language is German. >>> >>> I have also tried not passing the localize form field argument as well >>> as localize off template tag, but both didn't work. >>> >>> I could resolve the issue by rending the field manually and setting the >>> date form to yyyy-mm-dd. >>> >>> Is it a browser issue or as the date input supports only value in >>> yyyy-mm-dd? >>> >>> Python version: 3.8. 10 and django: 3.0.14 >>> >>> >>> -- >>> 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...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/django-users/223f7686-eb61-4fcf-8f1a-b0f147b58b86n%40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/223f7686-eb61-4fcf-8f1a-b0f147b58b86n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > 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/a53317d7-1c50-4b5e-b9e7-64c1d7f115e9n%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/a53317d7-1c50-4b5e-b9e7-64c1d7f115e9n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAKGT9mxhPszMxQaZJGyUhrp4qVypx8K1Z5k1GFz8uRuo0jMHSQ%40mail.gmail.com.