chore: make module create and list endpoint response structure simillar (#2524)

This commit is contained in:
Nikhil 2023-10-27 15:31:15 +05:30 committed by GitHub
parent 55b2927a17
commit c8f98a9bc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -149,6 +149,9 @@ class ModuleViewSet(BaseViewSet):
if serializer.is_valid():
serializer.save()
module = Module.objects.get(pk=serializer.data["id"])
serializer = ModuleSerializer(module)
return Response(serializer.data, status=status.HTTP_201_CREATED)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)