I need to override the way a Select2 widget of a particular ForeignKey
is behaving in the Django (4.1) admin.
Namely, I am trying to increase the number of objects returned by the AJAX requests and defined by paginate_by
in AutocompleteJsonView
.
Sadly this great solution no longer works with Django 4.
How can I extend AutocompleteJsonView
and somehow tell Django to use my custom view?
EDIT: my current workaround is to override get_paginator
on the ModelAdmin
by setting paginator.per_page
to whatever value is suitable, but that doesn't answer to broader question of customising the autocomplete behaviour of Select2 widgets in the Django admin.