2013-11-01 5 views
7
Class user(ndb.Model): 
    def post(self): 
    name = db.StringProperty() 
    age = db.StringProperty() 
Class search(webapp2.RequestHandler): 
    def post(self): 
    x = userData.query().filter("age >=",1) #error points to this line 

エラーが発生する:ノード以外の引数をフィルタリングできません。受信の年齢> = 'ノード以外の引数をフィルタできない - データストア - Google App Engine - Python

私は私がこの問題を解決する方法を教えてくださいhttps://developers.google.com/appengine/docs/python/datastore/queries

で述べた構文を次のようしています。

答えて

12

私はようやくこれについての回答を
Google App Engine (python): filter users based on custom fieldsで見つけました。
https://developers.google.com/appengine/docs/python/ndb/queries#properties_by_string

で定義されているプロパティは、ndb.GenericProperty()として参照する必要があります。 質問に記載されているコードについては、フィルタの構文は次のようにする必要があります。

x = userData.query().filter(ndb.GenericProperty("age") >= 1).get() 
関連する問題