By default, the ajax behavior in autocomplete queries 10 first objs of the list and by scrolling you would see further next 10 results. But the scrolling doesn't work smoothly so I need to actually see all the result on the list by default. (it's loading 10 objs per scroll) Is there any option to change that or is there any way to manipulate the query to avoid chunked result?
Asked
Active
Viewed 89 times
1 Answers
2
paginate_by = XXX
taking the same example as per the doc :
class CountryAutocomplete(autocomplete.Select2QuerySetView):
paginate_by = 20
def get_queryset(self):
# Don't forget to filter out results depending on the visitor !
if not self.request.user.is_authenticated():
return Country.objects.none()
qs = Country.objects.all()
if self.q:
qs = qs.filter(name__istartswith=self.q)
return qs

Etienne Pouliot
- 114
- 3
-
Thanks. yes it works. I search it a lot. where did you find it? I couldn't find anything related to that in the docs. – JMJ Nov 22 '18 at 09:40