mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-22 23:04:21 +00:00
🔧 Get access serializer for list views
This commit is contained in:
parent
dcce2b9c9d
commit
cacd63e175
1 changed files with 2 additions and 4 deletions
|
@ -51,11 +51,9 @@ class ReadSophonViewSet(ReadOnlyModelViewSet, metaclass=abc.ABCMeta):
|
|||
return permissions.AllowAny,
|
||||
|
||||
def get_serializer_class(self):
|
||||
if self.action in ["list"]:
|
||||
return self.get_queryset().model.get_view_serializer()
|
||||
elif self.action in ["create", "metadata"]:
|
||||
if self.action in ["create", "metadata"]:
|
||||
return self.get_queryset().model.get_creation_serializer()
|
||||
elif self.action in ["retrieve", "update", "partial_update", "destroy"]:
|
||||
elif self.action in ["list", "retrieve", "update", "partial_update", "destroy"]:
|
||||
return self.get_object().get_access_serializer(self.request.user)
|
||||
else:
|
||||
return self.get_custom_serializer_classes()
|
||||
|
|
Loading…
Reference in a new issue