Commit b1c88f9a authored by Serge S. Koval's avatar Serge S. Koval

URLField, EmailField are now searchable in MongoEngine backend. #151

parent 6b21b43b
......@@ -87,6 +87,13 @@ class ModelView(BaseModelView):
Customized type formatters for MongoEngine backend
"""
allowed_search_types = (mongoengine.StringField,
mongoengine.URLField,
mongoengine.EmailField)
"""
List of allowed search field types.
"""
def __init__(self, model, name=None,
category=None, endpoint=None, url=None):
"""
......@@ -184,7 +191,7 @@ class ModelView(BaseModelView):
field_type = type(p)
# Check type
if (field_type != mongoengine.StringField):
if (field_type not in self.allowed_search_types):
raise Exception('Can only search on text columns. ' +
'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