From 060dc3b41abb47ec9b6e3039f4bbe69676cbf795 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Fri, 28 Jan 2022 19:41:30 +0100 Subject: [PATCH] Add object_list to BaseListView (#833) While `object_list` isn't defined at construction, `BaseListView.get()` sets it when handling a request, so in practice it is defined whenever a list view is doing its work. The Django documentation describes `object_list` as "the list of objects (usually, but not necessarily a queryset)", so I picked `Sequence` as the type. Closes #790 --- django-stubs/views/generic/list.pyi | 1 + 1 file changed, 1 insertion(+) diff --git a/django-stubs/views/generic/list.pyi b/django-stubs/views/generic/list.pyi index b8c8d02..0775a13 100644 --- a/django-stubs/views/generic/list.pyi +++ b/django-stubs/views/generic/list.pyi @@ -30,6 +30,7 @@ class MultipleObjectMixin(Generic[T], ContextMixin): def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ... class BaseListView(MultipleObjectMixin[T], View): + object_list: Sequence[T] def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):