Search code examples
djangodjango-autocomplete-light

autocomplete light list shows only 20 items


I integrated autocomplete light with my django app.

In my registry i'm doing the following:

class HostAutocomplete( autocomplete_light.AutocompleteModelBase ):
    search_fields = [ 'hostname' ]
    choices = Host.objects.all()

In my form i have:

hosts=autocomplete_light.MultipleChoiceField('HostAutocomplete')

Autoocomplete is working fine but the list which i'm getting contains only 20 items. Database has many more entries. What could be the issue?


Solution

  • Add the limit_choices property to your autocomplete class:

    class HostAutocomplete(autocomplete_light.AutocompleteModelBase):
        ...
        limit_choices = 50