Tinkering a little with GAE's datastore i've found that i can't think a proper way to filter out results using the inequality filter '!=' on a multivalued property:
tags = db.StringListProperty()
e1 = Entry()
e2 = Entry()
e1.tags = ['tag1', 'tag2', 'tag3']
e2.tags = ['tag1', 'tag3', 'tag4']
# I want to exclude all the results containing 'tag2'
db.GqlQuery("""SELECT * FROM Entry
WHERE tags != 'tag2' """)
I've thought about this a bunch and I don't think there is a good way to do it (please correct me if I'm wrong). My non-clever solution is to not use StringListProperty and to cascade a bunch of filters:
class Entry(db.Model): ... tag_1 = db.StringProperty(); tag_2 = db.StringProperty(); ... Entry.all().filter('tag_1 !=', tag).filter('tag_2 !=', tag) ...
I'm not going to begin to describe the obvious problems with this solution, but at least it does what you want.