mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
style fix
This commit is contained in:
parent
6ca34276bd
commit
4013abe4de
@ -21,7 +21,6 @@ from django.views.generic import ListView, DetailView, CreateView, FormView, Del
|
||||
from django.views.generic.base import RedirectView, TemplateView
|
||||
|
||||
from djmoney.contrib.exchange.models import ExchangeBackend, Rate
|
||||
from rest_framework.schemas.coreapi import SchemaGenerator
|
||||
from common.settings import currency_code_default, currency_codes
|
||||
|
||||
from part.models import Part, PartCategory
|
||||
@ -773,12 +772,8 @@ class SearchResultView(TemplateView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
query = request.GET.get('term', '')
|
||||
if len(query) > 2:
|
||||
objects = Part.objects.filter(
|
||||
Q(name__icontains=query) |
|
||||
Q(description__icontains=query) |
|
||||
Q(IPN__icontains=query) |
|
||||
Q(keywords__icontains=query) |
|
||||
Q(category__name__icontains=query)).order_by('name')
|
||||
objects = Part.objects.filter(Q(name__icontains=query) | Q(description__icontains=query) | Q(IPN__icontains=query)
|
||||
| Q(keywords__icontains=query) | Q(category__name__icontains=query)).order_by('name')
|
||||
return JsonResponse([{'id': a.pk, 'value': a.name} for a in objects[0:5]], safe=False)
|
||||
return JsonResponse({})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user