I use the webapp2_extras.appengine.auth.models.User service, which basically extends google.appengine.api.users model . Now I have user users registered in my application, and they have many custom fields. The problem is that I want to filter / (multifilter) of all users using various custom fields. For example:
the user model has 2 fields is_active and activation_key now I want to filter them using these fields, for example:
from google.appengine.api import users act_key = 'hw-2j38he63u83hd6hak3FshSqj3TGemn9' user = users.all().filter('is_active =', False).filter('activation_key =', act_key).get() if user: return True else: return False
What are the best ways to filter in a custom model using custom fields?
Edit:
Also tried the following:
from webapp2_extras.appengine.auth.models import User query = User.query().filter('is_active =', False) print query
but this causes an error as follows:
Traceback (most recent call last): File "/opt/google_appengine_1.6.4/google/appengine/ext/admin/__init__.py", line 320, in post exec(compiled_code, globals()) File "<string>", line 6, in <module> File "lib/ndb/query.py", line 968, in filter raise TypeError('Cannot filter a non-Node argument; received %r' % arg) TypeError: Cannot filter a non-Node argument; received 'is_active ='
google-app-engine filter
Amyth
source share