Is there a way to search for multiple terms in admin search? django
问题 In the django admin search bar if i had a model with a column = fruit_name and I wanted to search that column for all instances with either the fruit_name = banana or apple which would show all of the bananas and apples, how could I do that? 回答1: Override the ModelAdmin.get_search_results` method: from operator import or_ from django.db.models import Q class MyAdmin(admin.ModelAdmin): ... def get_search_results(self, request, queryset, search_term): queryset, use_distinct = super(MyAdmin,