mirror of
https://github.com/Dadechin/Dashboard-XRoom.git
synced 2025-07-05 17:54:33 +00:00
get spaces
This commit is contained in:
parent
e630622529
commit
ef3e03f22c
|
@ -1163,6 +1163,15 @@ def addSpace(request):
|
||||||
data = request.data.copy()
|
data = request.data.copy()
|
||||||
data['userId'] = request.user.id # Automatically assign the authenticated user
|
data['userId'] = request.user.id # Automatically assign the authenticated user
|
||||||
|
|
||||||
|
# Retrieve the AssetBundleRoom instance from the provided ID
|
||||||
|
try:
|
||||||
|
asset_bundle_room = AssetBundleRoom.objects.get(id=data['assetBundleRoomId'])
|
||||||
|
except AssetBundleRoom.DoesNotExist:
|
||||||
|
return Response({"detail": "AssetBundleRoom not found."}, status=status.HTTP_404_NOT_FOUND)
|
||||||
|
|
||||||
|
# Assign the AssetBundleRoom instance to the data
|
||||||
|
data['assetBundleRoomId'] = asset_bundle_room
|
||||||
|
|
||||||
# Pass the request object to the serializer context
|
# Pass the request object to the serializer context
|
||||||
serializer = SpaceSerializer(data=data)
|
serializer = SpaceSerializer(data=data)
|
||||||
|
|
||||||
|
@ -1179,8 +1188,3 @@ def addSpace(request):
|
||||||
else:
|
else:
|
||||||
# If validation fails, return the errors
|
# If validation fails, return the errors
|
||||||
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user