Created
July 8, 2019 07:29
-
-
Save akshar-raaj/812c757d83aab0c0081913c3f6196b43 to your computer and use it in GitHub Desktop.
View
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class QuestionsView(APIView): | |
| def post(self, request, *args, **kwargs): | |
| serializer = QuestionSerializer(data=request.data) | |
| if serializer.is_valid(): | |
| question = serializer.save() | |
| serializer = QuestionSerializer(question) | |
| return Response(serializer.data, status=status.HTTP_201_CREATED) | |
| return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment