def create(self,request): serializer=NameSerializer(data=request.data) if serializer.is_valid(): name=serializer.data.get('name') msg='Hello {} your life will be settled in 2019'.format(name) return Response({'msg':msg}) return Response(serializer.errors,status=400)
def post(self,request): serializer=NameSerializer(data=request.data) if serializer.is_valid(): name=serializer.data.get('name') msg='Hello {} wish you happy new year !!!'.format(name) return Response({'msg':msg}) return Response(serializer.errors,status=400)