Skip to content

Instantly share code, notes, and snippets.

@jgeewax
Created August 20, 2010 22:46
Show Gist options
  • Save jgeewax/541356 to your computer and use it in GitHub Desktop.
Save jgeewax/541356 to your computer and use it in GitHub Desktop.
class BaseModel(db.Expando):
@classmethod
def filter_prefix(cls, property_name, prefix):
query = cls.all()
query.filter("%s >= " % property_name, u"%s" % prefix)
query.filter("%s < " % property_name, u"%s\xEF\xBF\xBD" % prefix)
return query
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment