Search code examples
pythondjangodjango-formsdjango-ajax-selects

Trouble searching User model using django-ajax-selects


I´m using django-ajax-selects in my project, and I can´t make it to work with django.contrib.auth.models.User. All I want to do is search the username field and I don´t know how to put it in my settings.py. What I have now is:

AJAX_LOOKUP_CHANNELS = {
    'to' : dict(model='django.contrib.auth.User', search_field='username'),
}

If I search one of my models, like this

AJAX_LOOKUP_CHANNELS = {
    'to' : dict(model='books.Book', search_field='title'),
}

Everything works fine, so I think I just need to know what to put in the model parameter.


Solution

  • Ok, after trying many combinations, mysteriously, this worked:

    AJAX_LOOKUP_CHANNELS = {
        'to' : dict(model='auth.User', search_field='username'),
    }