Answer the question
In order to leave comments, you need to log in
How to unpaginate in a child class?
There is such a loop
class AbstractSearchView(ListView):
paginate_by = 10
template_name = ''
search_form = None
def get_filter_func(self):
raise NotImplementedError
def get_queryset(self) -> 'QuerySet[SomeRequest]':
filter_func = self.get_filter_func()
try:
search_data = filter_func(self.request.GET)
except Exception:
search_data = {}
return SomeRequest.objects.filter(
**search_data
).order_by('-resident_id', '-created').distinct('resident_id')
def get_context_data(self, *args, **kwargs):
context = super().get_context_data(**kwargs)
context['form'] = self.search_form(self.request.GET)
return context
paginate_by = 0
Answer the question
In order to leave comments, you need to log in
Well, inheritance of classes is what inheritance is for)
What is taken from the parent.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question