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
7aeec0e0
Commit
7aeec0e0
authored
Apr 24, 2016
by
Paul Brown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow using 0 or False as a page_size
parent
cbb6acc5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
1 deletion
+23
-1
base.py
flask_admin/model/base.py
+1
-1
test_basic.py
flask_admin/tests/sqla/test_basic.py
+22
-0
No files found.
flask_admin/model/base.py
View file @
7aeec0e0
...
...
@@ -1817,7 +1817,7 @@ class BaseModelView(BaseView, ActionsMixin):
list_forms
[
self
.
get_pk_value
(
row
)]
=
self
.
list_form
(
obj
=
row
)
# Calculate number of pages
if
count
is
not
None
:
if
count
is
not
None
and
self
.
page_size
:
num_pages
=
count
//
self
.
page_size
if
count
%
self
.
page_size
!=
0
:
num_pages
+=
1
...
...
flask_admin/tests/sqla/test_basic.py
View file @
7aeec0e0
...
...
@@ -2027,6 +2027,28 @@ def test_simple_list_pager():
assert_true
(
count
is
None
)
def
test_unlimited_page_size
():
app
,
db
,
admin
=
setup
()
M1
,
_
=
create_models
(
db
)
db
.
session
.
add_all
([
M1
(
'1'
),
M1
(
'2'
),
M1
(
'3'
),
M1
(
'4'
),
M1
(
'5'
),
M1
(
'6'
),
M1
(
'7'
),
M1
(
'8'
),
M1
(
'9'
),
M1
(
'10'
),
M1
(
'11'
),
M1
(
'12'
),
M1
(
'13'
),
M1
(
'14'
),
M1
(
'15'
),
M1
(
'16'
),
M1
(
'17'
),
M1
(
'18'
),
M1
(
'19'
),
M1
(
'20'
),
M1
(
'21'
)])
view
=
CustomModelView
(
M1
,
db
.
session
)
# test 0 as page_size
_
,
data
=
view
.
get_list
(
0
,
None
,
None
,
None
,
None
,
execute
=
True
,
page_size
=
0
)
eq_
(
len
(
data
),
21
)
# test False as page_size
_
,
data
=
view
.
get_list
(
0
,
None
,
None
,
None
,
None
,
execute
=
True
,
page_size
=
False
)
eq_
(
len
(
data
),
21
)
def
test_advanced_joins
():
app
,
db
,
admin
=
setup
()
...
...
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