Are you saying that your query works, but it is returning a list
instead of a single instance?
If maybe this is what you want?
user = User.all().filter('GoogleAccount', users.get_current_user()).get()
if not user:
# make a new user or something
pass
Robert
On Tue, Oct 5, 2010 at 17:09, Geoff Parkhurst <[email protected]> wrote:
> Hi all,
>
> I've got this model:
>
> class User(db.Model):
> GoogleAccount = db.UserProperty()
> LastLogin=db.DateTimeProperty(auto_now=True)
>
> but am having trouble getting a single instance based on
> users.get_current_user()
>
> If I do:
>
> test=db.GqlQuery("SELECT * FROM User WHERE GoogleAccount =
> :1",users.get_current_user())
>
> ...I end up with a list of entities (well, a list with only one item)
> and have to do a "for something in test" loop.
>
> I'm sure I'm missing something... Can someone point me in the right direction?
>
> Many thanks
> Geoff
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.