I am trying this function, however something is wrong. I stored the name "John" but when i pass the john to username_ and call the check_user the output is always return results, even if the name is not stored in google data store. Why?
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"
In the case of GQL, how can i pass the variable username_ into the query? like:
qr = db.GqlQuery("Select * from Registrations Where username = ?????")
results is the query object not the result, you need to call query.filter('username =', username_).get() to return a single result or query.filter('username =', username_).fetch() to return all of them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With