From 3da67a8dabfcb85147362add7270e01e20f9a63f Mon Sep 17 00:00:00 2001 From: Donald Buczek Date: Sat, 15 Aug 2020 18:53:44 +0200 Subject: [PATCH] personal: Use index.AutocompleteField Wagtail is changing its search API [1]. There is a documentation PR pending at [2]. Our automplete hack - patch to make Wagtail Snippet Chooser use .autocomplete() instead of .search() - stopped working after the Wagtail update for the Contact snippet. Use wagtail.search.index.AutocompleteField in Contact model to specify, which fields should be indexed for autocompletion. [1] https://github.com/wagtail/wagtail/issues/4937 [2] https://github.com/wagtail/wagtail/issues/4938 --- mpicms/personal/models.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mpicms/personal/models.py b/mpicms/personal/models.py index 4e9b808..c7c87a4 100644 --- a/mpicms/personal/models.py +++ b/mpicms/personal/models.py @@ -126,8 +126,11 @@ class Contact(index.Indexed, ClusterableModel): search_fields = [ index.SearchField('first_name', partial_match=True), + index.AutocompleteField('first_name'), index.SearchField('last_name', partial_match=True), + index.AutocompleteField('last_name'), index.SearchField('email', partial_match=True), + index.AutocompleteField('email'), index.SearchField('phone'), index.SearchField('room'), index.FilterField('is_active')