データベースに新しいレコードを追加すると、python プロセスを再起動するまでオートコンプリートの結果に表示されません。私のレジストリは次のようになります。
import autocomplete_light
from .models import Article
autocomplete_light.register(
Article,
choices=Article.objects.published(),
search_fields=['title', '^id', ],
attrs={
'placeholder': 'Search by Article Name',
},
widget_attrs={
'class': 'modern-style',
},
)
選択オプションはキャッシュされていますか?