Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove request.POST save - incompatible with DRF v3.6.3. #15584

Merged
merged 1 commit into from
Jul 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lms/djangoapps/bulk_enroll/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class BulkEnrollView(APIView):
def post(self, request):
serializer = BulkEnrollmentSerializer(data=request.data)
if serializer.is_valid():
request.POST = request.data
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see that self.request gets passed in to students_update_enrollment below, and that function accesses request.POST. however, i don't understand if self.request and request are the same object?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears they are:

ipdb> id(request)
140610886734992
ipdb> id(self.request)
140610886734992

but it also appears that request.POST is the same as request.data:

ipdb> p request.POST
<QueryDict: {u'action': [u'enroll'], u'courses': [u'org.1/course_1/Run_1'], u'identifiers': [u'[email protected]'], u'email_students': [u'False']}>
ipdb> p request.data
<QueryDict: {u'action': [u'enroll'], u'courses': [u'org.1/course_1/Run_1'], u'identifiers': [u'[email protected]'], u'email_students': [u'False']}>
ipdb> id(request.POST)
140610886285712
ipdb> id(request.data)
140610886285712

So I'm unsure if there's a reason why this line exists.

response_dict = {
'auto_enroll': serializer.data.get('auto_enroll'),
'email_students': serializer.data.get('email_students'),
Expand Down