Issue
everyone.
I want to make a test in DRF. I follow this guide: https://www.youtube.com/watch?v=4Uy8NZsUfF0&t=3341s&ab_channel=JayCoding
Here I have a Response object: https://youtu.be/4Uy8NZsUfF0?t=3333
return Response('test': self.get_serializer(test, context={'request': self.request}).data, 'last_question_id':last_question)
And I get "Invalid syntax" on colons.
But in video it works.
When I change string to this:
return Response(self.get_serializer(test, context={'request': self.request}).data, last_question)
It works well. What should I change to make it work? Thank you.
Solution
please to try this :
return Response( { 'test': self.get_serializer(test, context={'request': self.request}).data,
'last_question_id':last_question } )
Answered By - Belhadjer Samir
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.