Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
2519ce91
Commit
2519ce91
authored
Oct 12, 2016
by
Alexey Evseev
Committed by
Tom Christie
Oct 12, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix schema generation with custom page_size pagination param (#4567)
parent
5677d063
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
rest_framework/pagination.py
+2
-2
tests/test_schemas.py
+3
-1
No files found.
rest_framework/pagination.py
View file @
2519ce91
...
...
@@ -290,9 +290,9 @@ class PageNumberPagination(BasePagination):
coreapi
.
Field
(
name
=
self
.
page_query_param
,
required
=
False
,
location
=
'query'
)
]
if
self
.
page_size_query_param
is
not
None
:
fields
.
append
(
[
fields
.
append
(
coreapi
.
Field
(
name
=
self
.
page_size_query_param
,
required
=
False
,
location
=
'query'
)
]
)
)
return
fields
...
...
tests/test_schemas.py
View file @
2519ce91
...
...
@@ -20,6 +20,7 @@ class MockUser(object):
class
ExamplePagination
(
pagination
.
PageNumberPagination
):
page_size
=
100
page_size_query_param
=
'page_size'
class
EmptySerializer
(
serializers
.
Serializer
):
...
...
@@ -64,7 +65,6 @@ class ExampleViewSet(ModelViewSet):
assert
self
.
action
return
super
(
ExampleViewSet
,
self
)
.
get_serializer
(
*
args
,
**
kwargs
)
if
coreapi
:
schema_view
=
get_schema_view
(
title
=
'Example API'
)
else
:
...
...
@@ -96,6 +96,7 @@ class TestRouterGeneratedSchema(TestCase):
action
=
'get'
,
fields
=
[
coreapi
.
Field
(
'page'
,
required
=
False
,
location
=
'query'
),
coreapi
.
Field
(
'page_size'
,
required
=
False
,
location
=
'query'
),
coreapi
.
Field
(
'ordering'
,
required
=
False
,
location
=
'query'
)
]
),
...
...
@@ -136,6 +137,7 @@ class TestRouterGeneratedSchema(TestCase):
action
=
'get'
,
fields
=
[
coreapi
.
Field
(
'page'
,
required
=
False
,
location
=
'query'
),
coreapi
.
Field
(
'page_size'
,
required
=
False
,
location
=
'query'
),
coreapi
.
Field
(
'ordering'
,
required
=
False
,
location
=
'query'
)
]
),
...
...
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