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
b2ebb680
Commit
b2ebb680
authored
Sep 30, 2015
by
muzaffaryousaf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRF uses query_params instead of QUERY_PARAMS.
TNL-3442
parent
c486f857
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
20 deletions
+20
-20
lms/djangoapps/course_structure_api/v0/views.py
+1
-1
lms/djangoapps/teams/views.py
+16
-16
openedx/core/djangoapps/user_api/accounts/views.py
+1
-1
openedx/core/djangoapps/user_api/views.py
+1
-1
openedx/core/lib/api/view_utils.py
+1
-1
No files found.
lms/djangoapps/course_structure_api/v0/views.py
View file @
b2ebb680
...
...
@@ -160,7 +160,7 @@ class CourseList(CourseViewMixin, ListAPIView):
serializer_class
=
serializers
.
CourseSerializer
def
get_queryset
(
self
):
course_ids
=
self
.
request
.
QUERY_PARAMS
.
get
(
'course_id'
,
None
)
course_ids
=
self
.
request
.
query_params
.
get
(
'course_id'
,
None
)
results
=
[]
if
course_ids
:
...
...
lms/djangoapps/teams/views.py
View file @
b2ebb680
...
...
@@ -383,8 +383,8 @@ class TeamsListView(ExpandableFieldViewMixin, GenericAPIView):
"""GET /api/team/v0/teams/"""
result_filter
=
{}
if
'course_id'
in
request
.
QUERY_PARAMS
:
course_id_string
=
request
.
QUERY_PARAMS
[
'course_id'
]
if
'course_id'
in
request
.
query_params
:
course_id_string
=
request
.
query_params
[
'course_id'
]
try
:
course_key
=
CourseKey
.
from_string
(
course_id_string
)
# Ensure the course exists
...
...
@@ -407,14 +407,14 @@ class TeamsListView(ExpandableFieldViewMixin, GenericAPIView):
status
=
status
.
HTTP_400_BAD_REQUEST
)
text_search
=
request
.
QUERY_PARAMS
.
get
(
'text_search'
,
None
)
if
text_search
and
request
.
QUERY_PARAMS
.
get
(
'order_by'
,
None
):
text_search
=
request
.
query_params
.
get
(
'text_search'
,
None
)
if
text_search
and
request
.
query_params
.
get
(
'order_by'
,
None
):
return
Response
(
build_api_error
(
ugettext_noop
(
"text_search and order_by cannot be provided together"
)),
status
=
status
.
HTTP_400_BAD_REQUEST
)
topic_id
=
request
.
QUERY_PARAMS
.
get
(
'topic_id'
,
None
)
topic_id
=
request
.
query_params
.
get
(
'topic_id'
,
None
)
if
topic_id
is
not
None
:
if
topic_id
not
in
[
topic
[
'id'
]
for
topic
in
course_module
.
teams_configuration
[
'topics'
]]:
error
=
build_api_error
(
...
...
@@ -457,7 +457,7 @@ class TeamsListView(ExpandableFieldViewMixin, GenericAPIView):
order_by_input
=
None
else
:
queryset
=
CourseTeam
.
objects
.
filter
(
**
result_filter
)
order_by_input
=
request
.
QUERY_PARAMS
.
get
(
'order_by'
,
'name'
)
order_by_input
=
request
.
query_params
.
get
(
'order_by'
,
'name'
)
if
order_by_input
==
'name'
:
# MySQL does case-insensitive order_by.
queryset
=
queryset
.
order_by
(
'name'
)
...
...
@@ -553,7 +553,7 @@ class TeamsListView(ExpandableFieldViewMixin, GenericAPIView):
# This code is taken from within the GenericAPIView#paginate_queryset method.
# We need need access to the page outside of that method for our paginate_search_results method
page_kwarg
=
self
.
kwargs
.
get
(
self
.
paginator
.
page_query_param
)
page_query_param
=
self
.
request
.
QUERY_PARAMS
.
get
(
self
.
paginator
.
page_query_param
)
page_query_param
=
self
.
request
.
query_params
.
get
(
self
.
paginator
.
page_query_param
)
return
page_kwarg
or
page_query_param
or
1
...
...
@@ -769,7 +769,7 @@ class TopicListView(GenericAPIView):
def
get
(
self
,
request
):
"""GET /api/team/v0/topics/?course_id={course_id}"""
course_id_string
=
request
.
QUERY_PARAMS
.
get
(
'course_id'
,
None
)
course_id_string
=
request
.
query_params
.
get
(
'course_id'
,
None
)
if
course_id_string
is
None
:
return
Response
({
'field_errors'
:
{
...
...
@@ -793,7 +793,7 @@ class TopicListView(GenericAPIView):
if
not
has_team_api_access
(
request
.
user
,
course_id
):
return
Response
(
status
=
status
.
HTTP_403_FORBIDDEN
)
ordering
=
request
.
QUERY_PARAMS
.
get
(
'order_by'
,
'name'
)
ordering
=
request
.
query_params
.
get
(
'order_by'
,
'name'
)
if
ordering
not
in
[
'name'
,
'team_count'
]:
return
Response
({
'developer_message'
:
"unsupported order_by value {ordering}"
.
format
(
ordering
=
ordering
),
...
...
@@ -1044,16 +1044,16 @@ class MembershipListView(ExpandableFieldViewMixin, GenericAPIView):
requested_course_key
=
None
accessible_course_ids
=
None
if
'course_id'
in
request
.
QUERY_PARAMS
:
requested_course_id
=
request
.
QUERY_PARAMS
[
'course_id'
]
if
'course_id'
in
request
.
query_params
:
requested_course_id
=
request
.
query_params
[
'course_id'
]
try
:
requested_course_key
=
CourseKey
.
from_string
(
requested_course_id
)
except
InvalidKeyError
:
return
Response
(
status
=
status
.
HTTP_404_NOT_FOUND
)
if
'team_id'
in
request
.
QUERY_PARAMS
:
if
'team_id'
in
request
.
query_params
:
specified_username_or_team
=
True
team_id
=
request
.
QUERY_PARAMS
[
'team_id'
]
team_id
=
request
.
query_params
[
'team_id'
]
try
:
team
=
CourseTeam
.
objects
.
get
(
team_id
=
team_id
)
except
CourseTeam
.
DoesNotExist
:
...
...
@@ -1063,9 +1063,9 @@ class MembershipListView(ExpandableFieldViewMixin, GenericAPIView):
if
not
has_team_api_access
(
request
.
user
,
team
.
course_id
):
return
Response
(
status
=
status
.
HTTP_404_NOT_FOUND
)
if
'username'
in
request
.
QUERY_PARAMS
:
if
'username'
in
request
.
query_params
:
specified_username_or_team
=
True
username
=
request
.
QUERY_PARAMS
[
'username'
]
username
=
request
.
query_params
[
'username'
]
if
not
request
.
user
.
is_staff
:
enrolled_courses
=
(
CourseEnrollment
.
enrollments_for_user
(
request
.
user
)
.
values_list
(
'course_id'
,
flat
=
True
)
...
...
@@ -1267,7 +1267,7 @@ class MembershipDetailView(ExpandableFieldViewMixin, GenericAPIView):
if
has_team_api_access
(
request
.
user
,
team
.
course_id
,
access_username
=
username
):
membership
=
self
.
get_membership
(
username
,
team
)
removal_method
=
'self_removal'
if
'admin'
in
request
.
QUERY_PARAMS
:
if
'admin'
in
request
.
query_params
:
removal_method
=
'removed_by_admin'
membership
.
delete
()
emit_team_event
(
...
...
openedx/core/djangoapps/user_api/accounts/views.py
View file @
b2ebb680
...
...
@@ -146,7 +146,7 @@ class AccountView(APIView):
GET /api/user/v1/accounts/{username}/
"""
try
:
account_settings
=
get_account_settings
(
request
,
username
,
view
=
request
.
QUERY_PARAMS
.
get
(
'view'
))
account_settings
=
get_account_settings
(
request
,
username
,
view
=
request
.
query_params
.
get
(
'view'
))
except
UserNotFound
:
return
Response
(
status
=
status
.
HTTP_403_FORBIDDEN
if
request
.
user
.
is_staff
else
status
.
HTTP_404_NOT_FOUND
)
...
...
openedx/core/djangoapps/user_api/views.py
View file @
b2ebb680
...
...
@@ -823,7 +823,7 @@ class ForumRoleUsersListView(generics.ListAPIView):
Return a list of users with the specified role/course pair
"""
name
=
self
.
kwargs
[
'name'
]
course_id_string
=
self
.
request
.
QUERY_PARAMS
.
get
(
'course_id'
)
course_id_string
=
self
.
request
.
query_params
.
get
(
'course_id'
)
if
not
course_id_string
:
raise
ParseError
(
'course_id must be specified'
)
course_id
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id_string
)
...
...
openedx/core/lib/api/view_utils.py
View file @
b2ebb680
...
...
@@ -79,7 +79,7 @@ class ExpandableFieldViewMixin(object):
def
get_serializer_context
(
self
):
"""Adds expand information from query parameters to the serializer context to support expandable fields."""
result
=
super
(
ExpandableFieldViewMixin
,
self
)
.
get_serializer_context
()
result
[
'expand'
]
=
[
x
for
x
in
self
.
request
.
QUERY_PARAMS
.
get
(
'expand'
,
''
)
.
split
(
','
)
if
x
]
result
[
'expand'
]
=
[
x
for
x
in
self
.
request
.
query_params
.
get
(
'expand'
,
''
)
.
split
(
','
)
if
x
]
return
result
...
...
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