Thanks for your help!

Sipum,
I have tried many possibilities and it is some how fixed and I actually 
don't know why, like why it is broken.........
but if you look into the class DateInput provided by Django:


class DateInput(DateTimeBaseInput):
format_key = 'DATE_INPUT_FORMATS'
template_name = 'django/forms/widgets/date.html'


it does the same thing, and the template only includes the template same as 
DateTimeBaseInput(which I don't get it)

so I end up inheriting the Django DateInput to create my own DateInput, all 
I need is change the input_type

from django.forms.widgets import DateInput as djangoDateInput


class DateInput(djangoDateInput):
input_type = 'date'

  
or consider what sachin said, simply set format_key = '%Y-%m-%d'





ANi於 2019年8月6日星期二 UTC+8下午2時28分24秒寫道:
>
> I've change the default date field widget slightly,
> but only like this and also define the DATE_INPUT_FORMATS
>
>
>
> class DateInput(DateTimeBaseInput):
> input_type = 'date'
> format_key = 'DATE_INPUT_FORMATS'
>
>
> DATE_INPUT_FORMATS = [
> '%Y-%m-%d',
> ]
>
>
> but still get error on the date field, only success at the first time 
> after I restart the server
>
> any reason could be?
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6e72a069-725f-46b1-9d54-a03f887f347e%40googlegroups.com.

Reply via email to