我正在尝试这个功能,但是出了点问题。我存储了名称“John”,但是当我将 john 传递给username_
并调用check_user
输出return results
时,即使该名称未存储在谷歌数据存储中也是如此。为什么?
def check_user(self, username_):
query = db.Query(Registrations)
results = query.filter('username =', username_)
if results:
return results
user_username = self.request.get('username')
check_username_valid = self.check_user(user_username)
if not check_username_valid:
error_username_exists="Username already exists"
在 GQL 的情况下,我如何将变量传递username_
到查询中?像:
qr = db.GqlQuery("Select * from Registrations Where username = ?????")