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
c9228e49
Commit
c9228e49
authored
May 15, 2014
by
Sergey Markelov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+) Allow to set select2.minimumInputLength from AjaxSelect2Widget.
Default to 1
parent
eddc1e17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
widgets.py
flask_admin/model/widgets.py
+1
-0
form.js
flask_admin/static/admin/js/form.js
+3
-1
No files found.
flask_admin/model/widgets.py
View file @
c9228e49
...
...
@@ -27,6 +27,7 @@ class AjaxSelect2Widget(object):
def
__call__
(
self
,
field
,
**
kwargs
):
kwargs
[
'data-role'
]
=
u'select2-ajax'
kwargs
[
'data-url'
]
=
url_for
(
'.ajax_lookup'
,
name
=
field
.
loader
.
name
)
kwargs
[
'data-minimum-input-length'
]
=
int
(
getattr
(
field
,
'minimum_input_length'
,
1
)
)
allow_blank
=
getattr
(
field
,
'allow_blank'
,
False
)
if
allow_blank
and
not
self
.
multiple
:
...
...
flask_admin/static/admin/js/form.js
View file @
c9228e49
...
...
@@ -11,7 +11,7 @@
var
opts
=
{
width
:
'resolve'
,
minimumInputLength
:
1
,
minimumInputLength
:
$el
.
attr
(
'data-minimum-input-length'
)
,
placeholder
:
'data-placeholder'
,
ajax
:
{
url
:
$el
.
attr
(
'data-url'
),
...
...
@@ -93,6 +93,8 @@
if
(
$el
.
attr
(
'data-allow-blank'
))
opts
[
'allowClear'
]
=
true
;
opts
[
'minimumInputLength'
]
=
$el
.
attr
(
'data-minimum-input-length'
);
if
(
$el
.
attr
(
'data-tags'
))
{
$
.
extend
(
opts
,
{
tokenSeparators
:
[
','
],
...
...
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