From 240f588f376c718237b29f9f2d433946ad573735 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Wed, 20 Oct 2021 20:46:12 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20Use=20higher-level=20get=5Fseria?= =?UTF-8?q?lizer=5Fclass=20in=20actions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 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 8c63f36..5452593 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 = group.get_access_serializer(self.request.user) + Serializer = self.get_serializer_class() 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 = group.get_access_serializer(self.request.user) + Serializer = self.get_serializer_class() 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 2c1bdfc..6e2025c 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 = notebook.get_access_serializer(request.user) + Serializer = self.get_serializer_class() 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 = notebook.get_access_serializer(request.user) + Serializer = self.get_serializer_class() 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 = notebook.get_access_serializer(request.user) + Serializer = self.get_serializer_class() 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 = notebook.get_access_serializer(request.user) + Serializer = self.get_serializer_class() 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 = notebook.get_access_serializer(request.user) + Serializer = self.get_serializer_class() serializer = Serializer(notebook) return Response(serializer.data, status.HTTP_200_OK)