I have the following model of Users and I want to get all the users that like 'yellow', but don't like 'red'.
class User(db.Model):
name = db.StringProperty(required=True)
favorite_colors = db.StringListProperty(required=True)
This works (all users that have at least one favorite color 'yellow' are returned):
results = db.GqlQuery(
"SELECT * FROM User "
"WHERE favorite_colors = 'yellow'")
But this does not do what I expected:
results = db.GqlQuery(
"SELECT * FROM User "
"WHERE favorite_colors = 'yellow' "
"and favorite_colors != 'red'")
The same list of users is returned. I believe that it's testing if any of the favorite colors are different from 'red' and not if the list does not contain 'red' at all.
How can I filter only the results that contain an item and not another one?