From 7c8dd8383cda10c410b6239b46d43f3f9dc42955 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 20 Oct 2021 21:27:36 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20"=F0=9F=94=A7=20Use=20higher-level=20g?= =?UTF-8?q?et=5Fserializer=5Fclass=20in=20actions"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 6de5347e3eb105fc0fccf1e3313b94925f080e52. --- backend/sophon/core/views.py | 4 ++-- backend/sophon/notebooks/views.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) 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)