-
-
Notifications
You must be signed in to change notification settings - Fork 516
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Quoting django:
class MultipleObjectMixin(ContextMixin):
"""A mixin for views manipulating multiple objects."""
def get_queryset(self):
"""
Return the list of items for this view.
The return value must be an iterable and may be an instance of
`QuerySet` in which case `QuerySet` specific behavior will be enabled.
"""And it is later used like so:
class BaseListView(MultipleObjectMixin, View):
def get(self, request, *args, **kwargs):
self.object_list = self.get_queryset()
allow_empty = self.get_allow_empty()
if not allow_empty:
# When pagination is enabled and object_list is a queryset,
# it's better to do a cheap query than to load the unpaginated
# queryset in memory.
if self.get_paginate_by(self.object_list) is not None and hasattr(
self.object_list, "exists"
):
is_empty = not self.object_list.exists()
else:
is_empty = not self.object_listIn runtime - any Iterable works. So, we must fix the allowed return type of get_queryset
See django/views/generic/list.py
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working