Commit 94d41f7c authored by Paul Brown's avatar Paul Brown Committed by GitHub

Merge pull request #1527 from nad2000/peewee-search-in-text-fields

allow to use inherited form CharField or TextField fields for searching
parents f5628d79 8d4118ce
...@@ -213,10 +213,8 @@ class ModelView(BaseModelView): ...@@ -213,10 +213,8 @@ class ModelView(BaseModelView):
if isinstance(p, string_types): if isinstance(p, string_types):
p = getattr(self.model, p) p = getattr(self.model, p)
field_type = type(p)
# Check type # Check type
if (field_type != CharField and field_type != TextField): if not isinstance(p, (CharField, TextField)):
raise Exception('Can only search on text columns. ' + raise Exception('Can only search on text columns. ' +
'Failed to setup search for "%s"' % p) 'Failed to setup search for "%s"' % p)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment