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
This commit is contained in:
Maarten ter Huurne
2022-01-28 19:41:30 +01:00
committed by GitHub
parent 5d3768e593
commit 060dc3b41a

View File

@@ -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):