Hi Peter,

One way to gurantee that the owner property is set and not None would be to
make the URL require login in your app.yaml file (not sure if this will work
for you), you could also check before creating the entity by calling
get_current_user(). Do you need to use the generic view?

To query on owner, you could pass a User object into the GQL query or
filter, for example see

http://code.google.com/appengine/docs/python/datastore/queryclass.html#Query_filter

query.filter('owner = ', users.get_current_user())

or in GQL

("... WHERE owner = :1 ...", users.get_current_user(), ...)

Happy coding,

Jeff

On Sat, Sep 12, 2009 at 4:18 PM, Peter Newman <
peter.newman....@googlemail.com> wrote:

>
> Guys -
>
> I have a class
> 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)
>
> however if i add an record in Django with the generic view the field
> owner stays blank?
>
> Second if i next want to filter on entries from a certain user. How
> would i do that?
>
> >
>

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

Reply via email to