Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
mpicms/patches/hack-snippets-chooser-to-use-autocomplete.patch
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (24 sloc)
1.25 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 740a083bf5879e37a35e510e1da789cc441040d8 Mon Sep 17 00:00:00 2001 | |
From: Donald Buczek <buczek@molgen.mpg.de> | |
Date: Tue, 19 Nov 2019 15:27:16 +0100 | |
Subject: [PATCH] Hack snippets chooser to use autocomplete | |
Users wanted to have partial search when Contacts are selected by the | |
Chooser. The Chooser doesn't have the feature to use partial matches and | |
our postgres_search doesn't support it in its search() method anyway. | |
Try to get away with changing the Chooserd to use autocomplete(). | |
--- | |
lib/python3.7/site-packages/wagtail/snippets/views/chooser.py | 2 +- | |
1 file changed, 1 insertion(+), 1 deletion(-) | |
diff --git a/lib/python3.7/site-packages/wagtail/snippets/views/chooser.py b/lib/python3.7/site-packages/wagtail/snippets/views/chooser.py | |
index 7c93edd..66ece97 100644 | |
--- a/lib/python3.7/site-packages/wagtail/snippets/views/chooser.py | |
+++ b/lib/python3.7/site-packages/wagtail/snippets/views/chooser.py | |
@@ -35,7 +35,7 @@ def choose(request, app_label, model_name): | |
search_query = search_form.cleaned_data['q'] | |
search_backend = get_search_backend() | |
- items = search_backend.search(search_query, items) | |
+ items = search_backend.autocomplete(search_query, items) | |
is_searching = True | |
else: | |
-- | |
2.26.2 | |