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
cc40c6de
Commit
cc40c6de
authored
Oct 05, 2018
by
PJ Janse van Rensburg
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/sealemar/flask-admin
into ajax-min-input-length
parents
9264a987
fba873d5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
17 deletions
+24
-17
ajax.py
flask_admin/contrib/mongoengine/ajax.py
+9
-8
ajax.py
flask_admin/contrib/peewee/ajax.py
+9
-8
widgets.py
flask_admin/model/widgets.py
+3
-0
form.js
flask_admin/static/admin/js/form.js
+3
-1
No files found.
flask_admin/contrib/mongoengine/ajax.py
View file @
cc40c6de
...
...
@@ -50,6 +50,7 @@ class QueryAjaxModelLoader(AjaxModelLoader):
def
get_list
(
self
,
term
,
offset
=
0
,
limit
=
DEFAULT_PAGE_SIZE
):
query
=
self
.
model
.
objects
if
len
(
term
)
>
0
:
criteria
=
None
for
field
in
self
.
_cached_fields
:
...
...
flask_admin/contrib/peewee/ajax.py
View file @
cc40c6de
...
...
@@ -52,6 +52,7 @@ class QueryAjaxModelLoader(AjaxModelLoader):
def
get_list
(
self
,
term
,
offset
=
0
,
limit
=
DEFAULT_PAGE_SIZE
):
query
=
self
.
model
.
select
()
if
len
(
term
)
>
0
:
stmt
=
None
for
field
in
self
.
_cached_fields
:
q
=
field
**
(
u'
%%%
s
%%
'
%
term
)
...
...
flask_admin/model/widgets.py
View file @
cc40c6de
...
...
@@ -61,6 +61,9 @@ class AjaxSelect2Widget(object):
placeholder
=
field
.
loader
.
options
.
get
(
'placeholder'
,
gettext
(
'Please select model'
))
kwargs
.
setdefault
(
'data-placeholder'
,
placeholder
)
minimum_input_length
=
int
(
field
.
loader
.
options
.
get
(
'minimum_input_length'
,
1
))
kwargs
.
setdefault
(
'data-minimum-input-length'
,
minimum_input_length
)
return
HTMLString
(
'<input
%
s>'
%
html_params
(
name
=
field
.
name
,
**
kwargs
))
...
...
flask_admin/static/admin/js/form.js
View file @
cc40c6de
...
...
@@ -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'
),
...
...
@@ -305,6 +305,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