Re: Enter valid date error

2019-08-07 Thread ANi
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6e72a069-725f-46b1-9d54-a03f887f347e%40googlegroups.com.


Re: Enter valid date error

2019-08-06 Thread sachinbg sachin
Give the format in year month date it will be resolved then

On Tue, Aug 6, 2019, 10:24 PM DPM  wrote:

> Hey Ani,
>
> Change format_key = DATE_INPUT_FORMATS.
> Omit the quotes. Then will work fine.
>
>
> On Tue, 6 Aug, 2019, 11:59 AM ANi,  wrote:
>
>> 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 django-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/6d5257f5-e7aa-41ff-a0f7-8d4936e73167%40googlegroups.com
>> 
>> .
>>
> --
> 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/CAGHZBzymjKTT0cAWna6ezf%3DsPmJAvkkDTd0i9oDjK2pqpm%2Bj6A%40mail.gmail.com
> 
> .
>

-- 
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/CAOs61ry4KQ-QPHq3039QJBh3VjtvDO1zBE_C4baYPocSZ1FGNw%40mail.gmail.com.


Re: Enter valid date error

2019-08-06 Thread DPM
Hey Ani,

Change format_key = DATE_INPUT_FORMATS.
Omit the quotes. Then will work fine.


On Tue, 6 Aug, 2019, 11:59 AM ANi,  wrote:

> 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 django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/6d5257f5-e7aa-41ff-a0f7-8d4936e73167%40googlegroups.com
> 
> .
>

-- 
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/CAGHZBzymjKTT0cAWna6ezf%3DsPmJAvkkDTd0i9oDjK2pqpm%2Bj6A%40mail.gmail.com.


Enter valid date error

2019-08-06 Thread ANi
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 django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6d5257f5-e7aa-41ff-a0f7-8d4936e73167%40googlegroups.com.