This commit is contained in:
behruz-dev
2025-10-04 14:57:02 +05:00
parent 11de0f01fe
commit 5ff390e2d7

View File

@@ -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(