1
Fork 0
mirror of https://github.com/Steffo99/sophon.git synced 2024-12-22 14:54:22 +00:00

Revert "🔧 Use higher-level get_serializer_class in actions"

This reverts commit 6de5347e3eb105fc0fccf1e3313b94925f080e52.
This commit is contained in:
Steffo 2021-10-20 21:27:36 +02:00
parent 240f588f37
commit 7c8dd8383c
2 changed files with 7 additions and 7 deletions

View file

@ -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)

View file

@ -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)