def post(self, request, format=None): serializer = TalentSkillSerializer(data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data, status=status.HTTP_201_CREATED) return Response({'error': serializer.errors}, status=status.HTTP_400_BAD_REQUEST)
def put(self, request, pk, format=None): talent_skill_item = self.get_object(pk) serializer = TalentSkillSerializer(talent_skill_item, data=request.data) if serializer.is_valid(): serializer.save() return Response(serializer.data) return Response({'error': serializer.errors}, status=status.HTTP_400_BAD_REQUEST)