def endswith(self, value): if self.type in ('string', 'text'): return Query(self, ' LIKE ', '%%%s' % value) else: raise RuntimeError, "startswith used with incompatible field type"
The last line should be raise RuntimeError, "endswith used with incompatible field type"