4 | | def get_search_results(self, request, queryset, search_term): |
5 | | parts = search_term.split() |
6 | | try: |
7 | | for part in text.smart_split(search_term): |
8 | | text.unescape_string_literal(part) |
9 | | except ValueError: |
10 | | parts = map(lambda t: str(t).strip('"').strip("'"), parts) |
11 | | return super().get_search_results(request, queryset, ' '.join(parts)) |
| 4 | from django.utils import text |
| 5 | |
| 6 | |
| 7 | class ModelAdmin(...): |
| 8 | |
| 9 | ... |
| 10 | |
| 11 | def get_search_results(self, request, queryset, search_term): |
| 12 | parts = search_term.split() |
| 13 | try: |
| 14 | for part in text.smart_split(search_term): |
| 15 | text.unescape_string_literal(part) |
| 16 | except ValueError: |
| 17 | parts = map(lambda t: str(t).strip('"').strip("'"), parts) |
| 18 | return super().get_search_results(request, queryset, ' '.join(parts)) |