change
This commit is contained in:
@@ -26,9 +26,13 @@ class ProductCreateApiView(generics.GenericAPIView):
|
|||||||
def post(self, request):
|
def post(self, request):
|
||||||
serializer = self.serializer_class(data=request.data)
|
serializer = self.serializer_class(data=request.data)
|
||||||
if serializer.is_valid(raise_exception=True):
|
if serializer.is_valid(raise_exception=True):
|
||||||
serializer.save()
|
data = serializer.save()
|
||||||
return Response(
|
return Response(
|
||||||
{'success': True, 'message': "product successfully created!"},
|
{
|
||||||
|
'success': True,
|
||||||
|
'message': "product successfully created!",
|
||||||
|
'product': self.serializer_class(data)
|
||||||
|
},
|
||||||
status=201
|
status=201
|
||||||
)
|
)
|
||||||
return Response(
|
return Response(
|
||||||
|
|||||||
Reference in New Issue
Block a user