ModelAdmin.autocomplete_fields looks to be very simple to implement into the Django admin:
class UserAdmin(admin.ModelAdmin):
autocomplete_fields = ['material']
admin.site.register(User, UserAdmin)
class MaterialAdmin(admin.ModelAdmin):
search_fields = ['name']
admin.site.register(Material, MaterialAdmin)
It renders the field correctly (as a search field instead of a dropdown), but the search field says "The results could not be loaded" and inspect shows:
*/admin/autocomplete/ 403 (Forbidden) jquery.js:9203
I assume there is a csrf issue receiving data from the Material model. I looked into ways to exempt this request from csrf but couldn't figure out how to do it through ModelAdmin.autocomplete_fields.
I tried using django-autocomplete-light as well and couldn't get it working.