开发者

Trouble searching User model using django-ajax-selects

开发者 https://www.devze.com 2023-02-28 22:39 出处:网络
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 set

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', sea开发者_如何学Crch_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.


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

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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号