diff --git a/backend/sophon/core/views.py b/backend/sophon/core/views.py index 5452593..8c63f36 100644 --- a/backend/sophon/core/views.py +++ b/backend/sophon/core/views.py @@ -223,7 +223,7 @@ class ResearchGroupViewSet(WriteSophonViewSet): group.members.add(self.request.user) # noinspection PyPep8Naming - Serializer = self.get_serializer_class() + Serializer = group.get_access_serializer(self.request.user) serializer = Serializer(instance=group) return Response(data=serializer.data, status=s.HTTP_200_OK) @@ -244,7 +244,7 @@ class ResearchGroupViewSet(WriteSophonViewSet): group.members.remove(self.request.user) # noinspection PyPep8Naming - Serializer = self.get_serializer_class() + Serializer = group.get_access_serializer(self.request.user) serializer = Serializer(instance=group) return Response(data=serializer.data, status=s.HTTP_200_OK) diff --git a/backend/sophon/notebooks/views.py b/backend/sophon/notebooks/views.py index 6e2025c..2c1bdfc 100644 --- a/backend/sophon/notebooks/views.py +++ b/backend/sophon/notebooks/views.py @@ -25,7 +25,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta): """ notebook: Notebook = self.get_object() notebook.sync_container() - Serializer = self.get_serializer_class() + Serializer = notebook.get_access_serializer(request.user) serializer = Serializer(notebook) return Response(serializer.data, status.HTTP_200_OK) @@ -36,7 +36,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta): """ notebook: Notebook = self.get_object() notebook.start() - Serializer = self.get_serializer_class() + Serializer = notebook.get_access_serializer(request.user) serializer = Serializer(notebook) return Response(serializer.data, status.HTTP_200_OK) @@ -51,7 +51,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta): if notebook.locked_by is None: notebook.locked_by = self.request.user notebook.save() - Serializer = self.get_serializer_class() + Serializer = notebook.get_access_serializer(request.user) serializer = Serializer(notebook) return Response(serializer.data, status.HTTP_200_OK) @@ -65,7 +65,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta): notebook: Notebook = self.get_object() notebook.locked_by = None notebook.save() - Serializer = self.get_serializer_class() + Serializer = notebook.get_access_serializer(request.user) serializer = Serializer(notebook) return Response(serializer.data, status.HTTP_200_OK) @@ -76,7 +76,7 @@ class NotebooksViewSet(SophonGroupViewSet, metaclass=abc.ABCMeta): """ notebook: Notebook = self.get_object() notebook.stop() - Serializer = self.get_serializer_class() + Serializer = notebook.get_access_serializer(request.user) serializer = Serializer(notebook) return Response(serializer.data, status.HTTP_200_OK)