Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
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
edx-platform
Commits
dbef3767
Commit
dbef3767
authored
Jul 22, 2015
by
Peter Fogg
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8999 from edx/peter-fogg/tnl-2703
Remove unnecessary DB call in team pagination.
parents
69a1a069
948f652c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
+8
-1
lms/djangoapps/teams/views.py
+8
-1
No files found.
lms/djangoapps/teams/views.py
View file @
dbef3767
...
...
@@ -319,7 +319,14 @@ class TeamsListView(ExpandableFieldViewMixin, GenericAPIView):
queryset
=
queryset
.
order_by
(
order_by_field
)
page
=
self
.
paginate_queryset
(
queryset
)
# TODO: Remove this on update to Django 1.8
# Use the cached length of the queryset in order to avoid
# making an extra database call to get the number of items in
# the collection
paginator
=
self
.
paginator_class
(
queryset
,
self
.
get_paginate_by
())
paginator
.
_count
=
len
(
queryset
)
# pylint: disable=protected-access
page
=
paginator
.
page
(
int
(
request
.
QUERY_PARAMS
.
get
(
'page'
,
1
)))
# end TODO
serializer
=
self
.
get_pagination_serializer
(
page
)
serializer
.
context
.
update
({
'sort_order'
:
order_by_input
})
# pylint: disable=maybe-no-member
return
Response
(
serializer
.
data
)
# pylint: disable=maybe-no-member
...
...
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