Reputation: 1941
I am using django forms but date is not showing in specific format.
forms.py
class MyForm(forms.ModelForm):
receive_date = forms.DateField(widget=forms.DateInput(attrs={'class': 'form-control ','readonly':True }),
input_formats=DATE_INPUT_FORMATS,
initial=date.today())
class Meta:
model = Mymodel
fields = "__all__"
When i load or reload the page date format is look like
after when i clicked on date format will change, but it should not be change. it look like this
in Html file, simply i used
{{forms.as_table}}
Thanks in advance
Upvotes: 2
Views: 561
Reputation: 23084
The date format for client side widgets cannot be set server side. For the native browser datepicker, the date format is determined by the operating system's locale. If you use a javascript plugin for date picker, you can typically customize the date format with javascript.
Upvotes: 1