Re: DateFormat in Django and Appengine

2009-09-27 Thread Karen Tracey
On Sun, Sep 27, 2009 at 6:51 PM, Peter Newman <
peter.newman@googlemail.com> wrote:

>
> Guys -
>
> I have a slight issue with dates in Django and appengine:
>
> I have the following class because i want date input in the form of DD/
> MM/YY
>
> class MyForm(ModelForm):
>  mydate = forms.DateTimeField(input_formats=['%d-%m-%y', '%d/%m/
> %y'])
>  class Meta:
>  model = MyObject
>
> This works for entering into the datastore.
> However when i use a generic view to edit the data the form comes back
> in the format of -MM-DD. Any ideas on how to change that?
>
>
Specify the format you want for existing values as the format parameter to a
DateTimeInput widget for the form field:

http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms.DateTimeInput

Note this is new in Django 1.1 so you will need to be running at least that
level.

Karen

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



DateFormat in Django and Appengine

2009-09-27 Thread Peter Newman

Guys -

I have a slight issue with dates in Django and appengine:

I have the following class because i want date input in the form of DD/
MM/YY

class MyForm(ModelForm):
  mydate = forms.DateTimeField(input_formats=['%d-%m-%y', '%d/%m/
%y'])
  class Meta:
  model = MyObject

This works for entering into the datastore.
However when i use a generic view to edit the data the form comes back
in the format of -MM-DD. Any ideas on how to change that?

Thanks
Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---