smart search in parent select
This commit is contained in:
parent
a9a1e77d91
commit
3ae860dbce
|
@ -99,7 +99,7 @@ class ItemSelectView(AutoResponseView):
|
|||
def get(self, request, *args, **kwargs):
|
||||
self.widget = self.get_widget_or_404()
|
||||
self.term = kwargs.get('term', request.GET.get('term', ''))
|
||||
self.object_list = self.get_queryset()
|
||||
self.object_list = apply_smart_search(self.term, Item.objects)
|
||||
context = self.get_context_data()
|
||||
return JsonResponse({
|
||||
'results': [
|
||||
|
|
|
@ -13,10 +13,6 @@ from django.contrib.admin.widgets import AdminTextareaWidget
|
|||
|
||||
|
||||
class ItemSelectWidget(ModelSelect2Widget):
|
||||
search_fields = [
|
||||
'name__icontains',
|
||||
'description__icontains'
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
kwargs['data_view'] = 'item-complete'
|
||||
|
|
Loading…
Reference in New Issue