NDB查询StringProperty + StructuredProperty

时间:2016-07-19 22:06:15

标签: google-app-engine google-cloud-datastore app-engine-ndb google-app-engine-python

我有这个型号:

class Author(ndb.Model):
    identity = ndb.StringProperty(indexed=False)
    email = ndb.StringProperty(indexed=True)

class Okr(ndb.Model):
    author = ndb.StructuredProperty(Author)
    obj = ndb.StringProperty(indexed=False)
    metric = ndb.IntegerProperty()
    img = ndb.StringProperty(indexed=False)  # image program
    date = ndb.DateTimeProperty(auto_now_add=True)

此实施:

        user = users.get_current_user()
        if user:
            url = users.create_logout_url(self.request.uri)
            url_linktext = 'Logout'

            logging.info(user.email())

            okrs_query = Okr.query(Okr.author.email == user.email()) #problem

            objetives = okrs_query.fetch()

            logging.info(objetives)

由okrs_query = Okr.query(Okr.author.email == user.email())表示的查询不起作用。如果我尝试执行相同的查询,但使用OKR.StringProperty它不起作用,但如果我使用OKR.IntegerProperty它一切都很好。思考?

0 个答案:

没有答案