Commit e5f9b3a2 authored by Samuel GAIST's avatar Samuel GAIST

[protocoltemplates][api] Fixed ListCreateView base class and queryset

parent e32313bc
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
from ..common import permissions as beat_permissions from ..common import permissions as beat_permissions
from ..common.api import CheckContributionNameView from ..common.api import CheckContributionNameView
from ..common.api import ListCreateContributionView from ..common.api import ListCreateBaseView
from ..common.api import RetrieveUpdateDestroyContributionView from ..common.api import RetrieveUpdateDestroyContributionView
from ..common.api import ShareView as CommonShareView from ..common.api import ShareView as CommonShareView
from .models import ProtocolTemplate from .models import ProtocolTemplate
...@@ -64,7 +64,7 @@ class ShareView(CommonShareView): ...@@ -64,7 +64,7 @@ class ShareView(CommonShareView):
# ---------------------------------------------------------- # ----------------------------------------------------------
class ListCreateView(ListCreateContributionView): class ListCreateView(ListCreateBaseView):
""" """
Read/Write end point that list the protocol templates available Read/Write end point that list the protocol templates available
and allows the creation of new protocol templates only to admins and allows the creation of new protocol templates only to admins
...@@ -76,6 +76,13 @@ class ListCreateView(ListCreateContributionView): ...@@ -76,6 +76,13 @@ class ListCreateView(ListCreateContributionView):
writing_serializer_class = ProtocolTemplateCreationSerializer writing_serializer_class = ProtocolTemplateCreationSerializer
namespace = "api_protocoltemplates" namespace = "api_protocoltemplates"
def get_queryset(self):
"""
Returns what the requesting user can see including public items
"""
return self.model.objects.for_user(self.request.user, True)
# ---------------------------------------------------------- # ----------------------------------------------------------
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment