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
ceb45b46
Commit
ceb45b46
authored
Oct 27, 2018
by
PJ Janse van Rensburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow filtering on new sqla_utils fields.
parent
f6d22959
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
2 deletions
+16
-2
filters.py
flask_admin/contrib/sqla/filters.py
+16
-2
No files found.
flask_admin/contrib/sqla/filters.py
View file @
ceb45b46
...
...
@@ -440,6 +440,8 @@ class ChoiceTypeNotLikeFilter(FilterNotLike):
class
FilterConverter
(
filters
.
BaseFilterConverter
):
strings
=
(
FilterLike
,
FilterNotLike
,
FilterEqual
,
FilterNotEqual
,
FilterEmpty
,
FilterInList
,
FilterNotInList
)
string_key_filters
=
(
FilterEqual
,
FilterNotEqual
,
FilterEmpty
,
FilterInList
,
FilterNotInList
)
int_filters
=
(
IntEqualFilter
,
IntNotEqualFilter
,
IntGreaterFilter
,
IntSmallerFilter
,
FilterEmpty
,
IntInListFilter
,
IntNotInListFilter
)
...
...
@@ -460,7 +462,10 @@ class FilterConverter(filters.BaseFilterConverter):
TimeSmallerFilter
,
TimeBetweenFilter
,
TimeNotBetweenFilter
,
FilterEmpty
)
choice_type_filters
=
(
ChoiceTypeEqualFilter
,
ChoiceTypeNotEqualFilter
,
ChoiceTypeLikeFilter
,
ChoiceTypeNotLikeFilter
,
FilterEmpty
)
ChoiceTypeLikeFilter
,
ChoiceTypeNotLikeFilter
,
FilterEmpty
)
arrow_type_filters
=
(
DateTimeGreaterFilter
,
DateTimeSmallerFilter
,
FilterEmpty
)
def
convert
(
self
,
type_name
,
column
,
name
,
**
kwargs
):
filter_name
=
type_name
.
lower
()
...
...
@@ -472,10 +477,15 @@ class FilterConverter(filters.BaseFilterConverter):
@
filters
.
convert
(
'string'
,
'char'
,
'unicode'
,
'varchar'
,
'tinytext'
,
'text'
,
'mediumtext'
,
'longtext'
,
'unicodetext'
,
'nchar'
,
'nvarchar'
,
'ntext'
,
'citext'
,
'emailtype'
)
'nchar'
,
'nvarchar'
,
'ntext'
,
'citext'
,
'emailtype'
,
'URLType'
,
'IPAddressType'
)
def
conv_string
(
self
,
column
,
name
,
**
kwargs
):
return
[
f
(
column
,
name
,
**
kwargs
)
for
f
in
self
.
strings
]
@
filters
.
convert
(
'UUIDType'
,
'ColorType'
,
'TimezoneType'
,
'CurrencyType'
)
def
conv_string_keys
(
self
,
column
,
name
,
**
kwargs
):
return
[
f
(
column
,
name
,
**
kwargs
)
for
f
in
self
.
string_key_filters
]
@
filters
.
convert
(
'boolean'
,
'tinyint'
)
def
conv_bool
(
self
,
column
,
name
,
**
kwargs
):
return
[
f
(
column
,
name
,
**
kwargs
)
for
f
in
self
.
bool_filters
]
...
...
@@ -505,6 +515,10 @@ class FilterConverter(filters.BaseFilterConverter):
def
conv_sqla_utils_choice
(
self
,
column
,
name
,
**
kwargs
):
return
[
f
(
column
,
name
,
**
kwargs
)
for
f
in
self
.
choice_type_filters
]
@
filters
.
convert
(
'ArrowType'
)
def
conv_sqla_utils_arrow
(
self
,
column
,
name
,
**
kwargs
):
return
[
f
(
column
,
name
,
**
kwargs
)
for
f
in
self
.
arrow_type_filters
]
@
filters
.
convert
(
'enum'
)
def
conv_enum
(
self
,
column
,
name
,
options
=
None
,
**
kwargs
):
if
not
options
:
...
...
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