linevych / django-search-admin-autocomplete

Simple django app that add autocomplete to search inside admin panel.
https://linevi.ch
30 stars 10 forks source link

The autocomplete does not work #7

Closed thtan89 closed 4 years ago

thtan89 commented 4 years ago

I have tried your code example but the autocomplete does not work.

from search_admin_autocomplete.admin import SearchAutoCompleteAdmin

class ImportBuildingUnitAdmin(SearchAutoCompleteAdmin, ImportExportModelAdmin):
    list_display = ( 'bu__short_name',)
    search_fields = ['bu__short_name', ]

I have included search_admin_autocomplete change list template also.

Please rectify the issue. Thank you.

Django 2.2.4 Python 3.7

linevych commented 4 years ago

Are there any errors in the browser console? Have you tried to run collectstatic?

thtan89 commented 4 years ago

Hi, @linevych , I have tried run the collectstatic & tried again, below is the screenshots of the output:

Screen Shot 2020-03-05 at 9 16 22 AM

But another admin I tried don't have this error but the autocomplete still not works.

linevych commented 4 years ago

I suspect your admin loads another version of JQuery after jquery.easy-autocomplete.jsis loaded. SearchAutoCompleteAdmin overrides change_list_template you can check out the template here and customize it if necessary.

thtan89 commented 4 years ago

Hi @linevych, I tried to customize the template but it also come out the same error "easyAutocomplete is not a function".

linevych commented 4 years ago

Have you checked if any other versions of JQuery are loaded in your code? Is jquery.easy-autocomplete.js actually loaded?

linevych commented 4 years ago

Closing because of inactivity.