python - Query on ReferenceProperty in Google App Engine -


I have two types of existence and the second is like this:

  class Entity1 (Db .Expando): prop1 = db.StringProperty () prop2 = db.StringProperty () class Entity2 (db.Expando): prop3 = db.ReferenceProperty (Entity1) prop4 = db.StringProperty ()   

Can I write a question:

  q = Entity2.all (). Filters ("prop3.prop1 =", somevalue)   

There is a reference to prop 3 and it is referring to some unit such as unit 1 and i want to know all those entities I like that unit 2, which shows the units of unit 1 that show prop1 as some value.

In my example I used to first use the key for the query as a filter for the query property Was obtained. Then you can query on the basis of the key based on the same key.

Example:

Model:

  class command (db.model): waiter = db Reference Property (Waiter, Required = True) Date = DB Datetimeproperty (expected = true) delivered = db. Boolean property (default = false) class waiter (db model): first name = db.StringProperty (required = true) last name = db.StringProperty (required = true) uuid = db.productproperty (required = true)   

Web request function: Get DEF (self): WaiterUID = self.quest.get ("waiter") q = wear.all () q. Filter ('uuid =', waiterUIID) waiter = q.get () result = {} result ['order'] = [] q = order.All () if waiterUud: q.filter ('waiter =', weight Raki) order = q.run ()

Comments