Re: Date format in modelform.

2009-08-04 Thread zayatzz
Thanks Karen! That was one awesome explanation of how datetime field and its widgets work. Could it be made sticky for all the future django beginners to read who have this kind of problems? I for one will certainly bookmark it so i can thrown this link to anybody who has similar problem. Alan

Re: Date format in modelform.

2009-08-04 Thread Karen Tracey
On Tue, Aug 4, 2009 at 2:05 PM, zayatzz wrote: > > Thanks everybody. > > I changed this : > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False ), > > for this : > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False, widget=forms.D

Re: Date format in modelform.

2009-08-04 Thread zayatzz
Oh and i will not fix problem in server application with a code in browser script. As i understand, javascript should be as unobtrusive as possible and fixing things that way: 1) is not unobtrusive 2) makes you write too much unnecessary code. Alan. On Aug 4, 9:05 pm, zayatzz wrote: > Thanks e

Re: Date format in modelform.

2009-08-04 Thread zayatzz
Thanks everybody. I changed this : birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', required=False ), for this : birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', required=False, widget=forms.DateInput(format='%d/%m/%Y') ) And it all works very good. But th

Re: Date format in modelform.

2009-08-03 Thread Margie
I did this with a combination of a DateWidget and a small .js file that calls the jquery datepicker on each widget. I don't use the same date format as you, but you should be able to modify it to fit your need. It's amazing how easy the code below looks, but I can tell you it took me most of a d

Re: Date format in modelform.

2009-08-03 Thread Karen Tracey
On Mon, Aug 3, 2009 at 2:08 PM, zayatzz wrote: > > Hello. > > I have this in my form (modelform) for birth_date field: > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False ), which overrides this in model: > > birth_date = models.DateField(help_text="birth date", > v

Re: Date format in modelform.

2009-08-03 Thread Malcolm Tredinnick
On Mon, 2009-08-03 at 11:08 -0700, zayatzz wrote: > Hello. > > I have this in my form (modelform) for birth_date field: > birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', > required=False ), which overrides this in model: > > birth_date = models.DateField(help_text="birth date", >

Re: Date format in modelform.

2009-08-03 Thread cootetom
I've always solved this problem in javascript. Plus if you're using jquery it's a bit easier. Before you set the date picker just format the date: $('input#id_date').val($('input#id_date').val().replace(/(\d+)-(\d+)- (\d+)/ig, '$3/$2/$1')).datepicker({showOn: 'focus', dateFormat: 'dd/mm/ yy'});

Date format in modelform.

2009-08-03 Thread zayatzz
Hello. I have this in my form (modelform) for birth_date field: birth_date = forms.DateField(('%d/%m/%Y',), label='Birth Date', required=False ), which overrides this in model: birth_date = models.DateField(help_text="birth date", verbose_name="Birth date", blank=True, null=True, ) I also have