List Info

Thread: DateField and output/input versus SelectDateWidget




DateField and output/input versus SelectDateWidget
country flaguser name
Belgium
2007-12-19 08:16:13
hello everyone,


A)
if you render a DateField it renders as: YYYY/MM/DD and then
you have to 
tell the user he should use the input_format ( which is
MM/DD/YYYY by 
default) which is kind of.... duh! 

B)
if you use the SelectDateWidget (in the code but not in the
docs) it 
will only work with a string as input, and not with a
datetime.date() as 
input.
I.e. using MyClass(instance=model_instance) it will not pick
up the date 
as the DateField obviously gives you a datetime and not a
string.


Does anyone know of a way of fixing either? 


cheerio!


  - bram

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: DateField and output/input versus SelectDateWidget
user name
2007-12-19 10:32:48


On Dec 19, 3:16 pm, Bram - Smartelectronix <b...smartelectronix.com>
wrote:
> hello everyone,
>
> A)
> if you render a DateField it renders as: YYYY/MM/DD and
then you have to
> tell the user he should use the input_format ( which is
MM/DD/YYYY by
> default) which is kind of.... duh! 

I wrote some code a while a go that adresses this issue. I
don't know
if the attacted patch still applies cleanly to trunk. If it
doesn't,
just let me know if you're interested, and I'll try and fix
it.

http://code
.djangoproject.com/ticket/5526

> B)
> if you use the SelectDateWidget (in the code but not in
the docs) it
> will only work with a string as input, and not with a
datetime.date() as
> input.
> I.e. using MyClass(instance=model_instance) it will not
pick up the date
> as the DateField obviously gives you a datetime and not
a string.
>

This is not in sync with the regular date/time widgets found
in
django.newforms.widgets. Please report this in trac.

Regards,

Jan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )