Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
flask-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
flask-admin
Commits
b1c88f9a
Commit
b1c88f9a
authored
Jul 20, 2013
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
URLField, EmailField are now searchable in MongoEngine backend. #151
parent
6b21b43b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletion
+8
-1
view.py
flask_admin/contrib/mongoengine/view.py
+8
-1
No files found.
flask_admin/contrib/mongoengine/view.py
View file @
b1c88f9a
...
@@ -87,6 +87,13 @@ class ModelView(BaseModelView):
...
@@ -87,6 +87,13 @@ class ModelView(BaseModelView):
Customized type formatters for MongoEngine backend
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
,
def
__init__
(
self
,
model
,
name
=
None
,
category
=
None
,
endpoint
=
None
,
url
=
None
):
category
=
None
,
endpoint
=
None
,
url
=
None
):
"""
"""
...
@@ -184,7 +191,7 @@ class ModelView(BaseModelView):
...
@@ -184,7 +191,7 @@ class ModelView(BaseModelView):
field_type
=
type
(
p
)
field_type
=
type
(
p
)
# Check type
# Check type
if
(
field_type
!=
mongoengine
.
StringField
):
if
(
field_type
not
in
self
.
allowed_search_types
):
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment