1
0
Fork 0

smart search in parent select

This commit is contained in:
d42 2018-04-28 20:44:47 +02:00
parent a9a1e77d91
commit 3ae860dbce
2 changed files with 1 additions and 5 deletions

View File

@ -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': [

View File

@ -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'