mirror of
https://github.com/davidhalter/django-stubs.git
synced 2025-12-16 16:57:12 +08:00
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:
committed by
GitHub
parent
5d3768e593
commit
060dc3b41a
@@ -30,6 +30,7 @@ class MultipleObjectMixin(Generic[T], ContextMixin):
|
|||||||
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
def get_context_object_name(self, object_list: QuerySet) -> Optional[str]: ...
|
||||||
|
|
||||||
class BaseListView(MultipleObjectMixin[T], View):
|
class BaseListView(MultipleObjectMixin[T], View):
|
||||||
|
object_list: Sequence[T]
|
||||||
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ...
|
||||||
|
|
||||||
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
class MultipleObjectTemplateResponseMixin(TemplateResponseMixin):
|
||||||
|
|||||||
Reference in New Issue
Block a user