mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 14:54:22 +00:00
🐛 Fix the serializer used by notebook actions
This commit is contained in:
parent
986652a4b1
commit
f4e0fdccb8
2 changed files with 9 additions and 6 deletions
|
@ -381,7 +381,10 @@ class Notebook(SophonGroupModel):
|
||||||
|
|
||||||
if self.container_id is None:
|
if self.container_id is None:
|
||||||
return None
|
return None
|
||||||
|
try:
|
||||||
return docker_client.containers.get(self.container_id)
|
return docker_client.containers.get(self.container_id)
|
||||||
|
except docker.errors.NotFound:
|
||||||
|
return None
|
||||||
|
|
||||||
def sync_container(self) -> t.Optional[docker.models.containers.Container]:
|
def sync_container(self) -> t.Optional[docker.models.containers.Container]:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -31,7 +31,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta):
|
||||||
"""
|
"""
|
||||||
notebook: Notebook = self.get_object()
|
notebook: Notebook = self.get_object()
|
||||||
notebook.sync_container()
|
notebook.sync_container()
|
||||||
Serializer = notebook.get_access_serializer(request.user)
|
Serializer = self.get_serializer_class()
|
||||||
serializer = Serializer(notebook)
|
serializer = Serializer(notebook)
|
||||||
return Response(serializer.data, status.HTTP_200_OK)
|
return Response(serializer.data, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta):
|
||||||
"""
|
"""
|
||||||
notebook: Notebook = self.get_object()
|
notebook: Notebook = self.get_object()
|
||||||
notebook.start()
|
notebook.start()
|
||||||
Serializer = notebook.get_access_serializer(request.user)
|
Serializer = self.get_serializer_class()
|
||||||
serializer = Serializer(notebook)
|
serializer = Serializer(notebook)
|
||||||
return Response(serializer.data, status.HTTP_200_OK)
|
return Response(serializer.data, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta):
|
||||||
if notebook.locked_by is None:
|
if notebook.locked_by is None:
|
||||||
notebook.locked_by = self.request.user
|
notebook.locked_by = self.request.user
|
||||||
notebook.save()
|
notebook.save()
|
||||||
Serializer = notebook.get_access_serializer(request.user)
|
Serializer = self.get_serializer_class()
|
||||||
serializer = Serializer(notebook)
|
serializer = Serializer(notebook)
|
||||||
return Response(serializer.data, status.HTTP_200_OK)
|
return Response(serializer.data, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta):
|
||||||
notebook: Notebook = self.get_object()
|
notebook: Notebook = self.get_object()
|
||||||
notebook.locked_by = None
|
notebook.locked_by = None
|
||||||
notebook.save()
|
notebook.save()
|
||||||
Serializer = notebook.get_access_serializer(request.user)
|
Serializer = self.get_serializer_class()
|
||||||
serializer = Serializer(notebook)
|
serializer = Serializer(notebook)
|
||||||
return Response(serializer.data, status.HTTP_200_OK)
|
return Response(serializer.data, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta):
|
||||||
"""
|
"""
|
||||||
notebook: Notebook = self.get_object()
|
notebook: Notebook = self.get_object()
|
||||||
notebook.stop()
|
notebook.stop()
|
||||||
Serializer = notebook.get_access_serializer(request.user)
|
Serializer = self.get_serializer_class()
|
||||||
serializer = Serializer(notebook)
|
serializer = Serializer(notebook)
|
||||||
return Response(serializer.data, status.HTTP_200_OK)
|
return Response(serializer.data, status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue