Changes between Initial Version and Version 1 of Ticket #32649, comment 3


Ignore:
Timestamp:
Apr 13, 2021, 5:02:07 PM (4 years ago)
Author:
Dlis

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #32649, comment 3

    initial v1  
    22
    33{{{
    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))
     4from django.utils import text
     5
     6
     7class 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))
    1219}}}
Back to Top