From 6565faf44d8950ed1f2ce4258f4b40e9abcbfe75 Mon Sep 17 00:00:00 2001 From: Tom Carrick Date: Fri, 12 Aug 2022 15:08:44 +0200 Subject: [PATCH] Add get_queryset to GenericAPIView (#26) ~~I took this from upstream and added the Mongo part, so hopefully it's alright~~, though my knowledge of the type system is a bit more limited than I'd like. Nevermind, I went with a simpler approach as the approach from upstream wasn't passing tests for me, not exactly sure why. --- rest_framework-stubs/generics.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/rest_framework-stubs/generics.pyi b/rest_framework-stubs/generics.pyi index 2dad49277..6ae651401 100644 --- a/rest_framework-stubs/generics.pyi +++ b/rest_framework-stubs/generics.pyi @@ -41,6 +41,7 @@ class GenericAPIView(views.APIView): @overload def paginate_queryset(self, queryset: MongoQuerySet[_T]) -> Optional[List[_T]]: ... def get_paginated_response(self, data: Any) -> Response: ... + def get_queryset(self) -> Union[QuerySet[_MT_co], MongoQuerySet[_T]]: ... class CreateAPIView(mixins.CreateModelMixin, GenericAPIView): def post(self, request: Request, *args: Any, **kwargs: Any) -> HttpResponse: ...