I have a List kind, and an User kind. I’m currently using IntegerProperty to associate User IDs with Lists, but I want to switch to ReferenceProperty. Currently, I’m using this code (with IntegerProperty):
db.GqlQuery("SELECT * FROM List WHERE UserID = :1", userid)
How should the code with ReferenceProperty look like? The script has the numeric ID of User (userid).
First, you need to construct a key from your ID. You can do that like this (presuming your User entity has no parent):
Now you can use it in a query just as you would anything else:
Or equivalently with a Query instead of GQL: