Skip to content

Commit

Permalink
Add object_list to BaseListView (#833)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mthuurne authored Jan 28, 2022
1 parent 5d3768e commit 060dc3b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions django-stubs/views/generic/list.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 060dc3b

Please sign in to comment.