Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions api/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
from api.nodes.permissions import ExcludeWithdrawals
from api.users.serializers import UserSerializer
from framework.auth.oauth_scopes import CoreScopes
from osf.models import Contributor, MaintenanceState, BaseFileNode
from osf.models import Contributor, MaintenanceState, BaseFileNode, AbstractNode
from osf.utils.permissions import API_CONTRIBUTOR_PERMISSIONS, READ, WRITE, ADMIN
from waffle.models import Flag, Switch, Sample
from waffle import sample_is_active
Expand Down Expand Up @@ -600,7 +600,7 @@ def get_queryset(self):
)


class BaseLinkedList(JSONAPIBaseView, generics.ListAPIView):
class BaseLinkedList(JSONAPIBaseView, generics.ListAPIView, ListFilterMixin):

permission_classes = (
drf_permissions.IsAuthenticatedOrReadOnly,
Expand All @@ -618,11 +618,9 @@ class BaseLinkedList(JSONAPIBaseView, generics.ListAPIView):
view_name = None

ordering = ('-modified',)
model_class = AbstractNode

# TODO: This class no longer exists
# model_class = Pointer

def get_queryset(self):
def get_default_queryset(self):
auth = get_user_auth(self.request)
from api.resources import annotations as resource_annotations

Expand All @@ -639,6 +637,9 @@ def get_queryset(self):
.order_by('-modified')
)

def get_queryset(self):
return self.get_queryset_from_request()


class WaterButlerMixin:

Expand Down
9 changes: 7 additions & 2 deletions api/collections/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ class LinkedNodesList(JSONAPIBaseView, generics.ListAPIView, CollectionMixin, No
view_name = 'linked-nodes'

ordering = ('-modified',)
model_class = Node

def get_default_queryset(self):
auth = get_user_auth(self.request)
Expand All @@ -589,7 +590,7 @@ def get_parser_context(self, http_request):
return res


class LinkedRegistrationsList(JSONAPIBaseView, generics.ListAPIView, CollectionMixin):
class LinkedRegistrationsList(JSONAPIBaseView, generics.ListAPIView, CollectionMixin, ListFilterMixin):
"""List of registrations linked to this node. *Read-only*.

Linked registrations are the registration nodes pointed to by node links.
Expand Down Expand Up @@ -667,8 +668,9 @@ class LinkedRegistrationsList(JSONAPIBaseView, generics.ListAPIView, CollectionM
required_write_scopes = [CoreScopes.COLLECTED_META_WRITE]

ordering = ('-modified',)
model_class = Registration

def get_queryset(self):
def get_default_queryset(self):
auth = get_user_auth(self.request)
return Registration.objects.filter(
guids__in=self.get_collection().active_guids.all(),
Expand All @@ -680,6 +682,9 @@ def get_queryset(self):
'-modified',
)

def get_queryset(self):
return self.get_queryset_from_request()

# overrides APIView
def get_parser_context(self, http_request):
"""
Expand Down
Loading