-1

I am using the django-ajax-select library to display a many to many relationship in the admin panel. The problem is that I have too many objects linked and it is making super long page.

Do you know if is there any way I can customize that element so it can have some kind of scrollbar or pagination?

Here is an example illustrating the problem: Image link

And this is how I added the element to the admin panel:

form = make_ajax_form(
    MainClass,
    {
        "users": "user", # LookupChannel is registered as user
        "admins": "user",
    },
)

1 Answers1

0

answer is on the first page of the django-ajax-select

https://django-ajax-selects.readthedocs.io/en/latest/

you should override get_query like this:

def get_query(self, q, request):
        return super().get_query(q, request)[your_search_limit]

your_search_limit - the length of the list you want to get.

Maxim Danilov
  • 2,472
  • 1
  • 3
  • 8