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
14dec4f5
Commit
14dec4f5
authored
Jun 03, 2015
by
Serge S. Koval
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #840 - Do not resolve filter lazy strings early
parent
7199475a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
3 deletions
+24
-3
base.py
flask_admin/model/base.py
+24
-3
No files found.
flask_admin/model/base.py
View file @
14dec4f5
...
@@ -15,7 +15,7 @@ from flask_admin.form import BaseForm, FormOpts, rules
...
@@ -15,7 +15,7 @@ from flask_admin.form import BaseForm, FormOpts, rules
from
flask_admin.model
import
filters
,
typefmt
from
flask_admin.model
import
filters
,
typefmt
from
flask_admin.actions
import
ActionsMixin
from
flask_admin.actions
import
ActionsMixin
from
flask_admin.helpers
import
(
get_form_data
,
validate_form_on_submit
,
from
flask_admin.helpers
import
(
get_form_data
,
validate_form_on_submit
,
get_redirect_target
,
flash_errors
)
get_redirect_target
,
flash_errors
)
from
flask_admin.tools
import
rec_getattr
from
flask_admin.tools
import
rec_getattr
from
flask_admin._backwards
import
ObsoleteAttr
from
flask_admin._backwards
import
ObsoleteAttr
from
flask_admin._compat
import
iteritems
,
OrderedDict
,
as_unicode
from
flask_admin._compat
import
iteritems
,
OrderedDict
,
as_unicode
...
@@ -619,7 +619,7 @@ class BaseModelView(BaseView, ActionsMixin):
...
@@ -619,7 +619,7 @@ class BaseModelView(BaseView, ActionsMixin):
self
.
_filter_groups
[
flt
.
name
]
.
append
({
self
.
_filter_groups
[
flt
.
name
]
.
append
({
'index'
:
i
,
'index'
:
i
,
'arg'
:
self
.
get_filter_arg
(
i
,
flt
),
'arg'
:
self
.
get_filter_arg
(
i
,
flt
),
'operation'
:
as_unicode
(
flt
.
operation
()
),
'operation'
:
flt
.
operation
(
),
'options'
:
flt
.
get_options
(
self
)
or
None
,
'options'
:
flt
.
get_options
(
self
)
or
None
,
'type'
:
flt
.
data_type
'type'
:
flt
.
data_type
})
})
...
@@ -854,6 +854,27 @@ class BaseModelView(BaseView, ActionsMixin):
...
@@ -854,6 +854,27 @@ class BaseModelView(BaseView, ActionsMixin):
else
:
else
:
return
str
(
index
)
return
str
(
index
)
def
_get_filter_groups
(
self
):
"""
Returns non-lazy version of filter strings
"""
if
self
.
_filter_groups
:
results
=
OrderedDict
()
for
key
,
value
in
iteritems
(
self
.
_filter_groups
):
items
=
[]
for
item
in
value
:
copy
=
dict
(
item
)
copy
[
'operation'
]
=
as_unicode
(
copy
[
'operation'
])
items
.
append
(
copy
)
results
[
key
]
=
items
return
results
return
None
# Form helpers
# Form helpers
def
scaffold_form
(
self
):
def
scaffold_form
(
self
):
"""
"""
...
@@ -1523,7 +1544,7 @@ class BaseModelView(BaseView, ActionsMixin):
...
@@ -1523,7 +1544,7 @@ class BaseModelView(BaseView, ActionsMixin):
# Filters
# Filters
filters
=
self
.
_filters
,
filters
=
self
.
_filters
,
filter_groups
=
self
.
_
filter_groups
,
filter_groups
=
self
.
_
get_filter_groups
()
,
active_filters
=
view_args
.
filters
,
active_filters
=
view_args
.
filters
,
# Actions
# Actions
...
...
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