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
-~--~~~~--~~--~--~---



Re: filter on entries from a certain user

2009-09-14 Thread Peter Newman

Ok i am a bit further. The above only works with Google's
authentication. However I want to use Django authentication. Is there
a way to add the current user to the model during creation of the
entity? There must be something similar as auro_current_user_add you
would think?

On Sep 13, 4:55 pm, Peter Bengtsson <pete...@gmail.com> wrote:
> I dont know what db.UserProperty() is but my guess is that that's
> something related to the model.
> Your form doesn't understand that so it defaults to None.
> If you omit the field owner from the form, perhaps the form won't
> attempt to fiddle with this and then the model is allowed to do it's
> magic.
> Something like this:
>
> class ContactForm(forms.ModelForm):
>     class Meta:
>         model = Contact
>         exclude = ('owner',)
>
> On Sep 13, 9:06 am, Peter Newman <peter.newman@googlemail.com>
> wrote:
>
>
>
> > Guys -
>
> > I have
> > class Contact(db.Model):
> >     person = db.ReferenceProperty(Person)
> >     contact_date = db.DateTimeProperty(auto_now_add=True)
> >     remarks = db.TextProperty()
> >     owner = db.UserProperty(auto_current_user_add=True)
>
> > and a simple form
> > class ContactForm(forms.ModelForm):
> >     class Meta:
> >         model = Contact
>
> > but when i add a record owner remains None??? what am i doing wrong?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



filter on entries from a certain user

2009-09-13 Thread Peter Newman

Guys -

I have
class Contact(db.Model):
person = db.ReferenceProperty(Person)
contact_date = db.DateTimeProperty(auto_now_add=True)
remarks = db.TextProperty()
owner = db.UserProperty(auto_current_user_add=True)

and a simple form
class ContactForm(forms.ModelForm):
class Meta:
model = Contact

but when i add a record owner remains None??? what am i doing wrong?

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---