pep
This commit is contained in:
parent
f0248babe7
commit
7e2bca899f
|
@ -1,10 +1,13 @@
|
|||
import shlex
|
||||
|
||||
from django.shortcuts import render, get_object_or_404, redirect
|
||||
from storage.models import Item, Label
|
||||
from django.contrib.postgres.search import SearchVector
|
||||
from django_select2.views import AutoResponseView
|
||||
from django.http import Http404, JsonResponse
|
||||
from django.contrib.admin.models import LogEntry
|
||||
import shlex
|
||||
from django_select2.views import AutoResponseView
|
||||
|
||||
from storage.models import Item, Label
|
||||
|
||||
|
||||
def apply_smart_search(query, objects):
|
||||
general_term = []
|
||||
|
@ -42,9 +45,11 @@ def apply_smart_search(query, objects):
|
|||
|
||||
return objects
|
||||
|
||||
|
||||
def index(request):
|
||||
return render(request, 'index.html')
|
||||
|
||||
|
||||
def search(request):
|
||||
query = request.GET.get('q', '')
|
||||
|
||||
|
@ -58,6 +63,7 @@ def search(request):
|
|||
'results': results.all(),
|
||||
})
|
||||
|
||||
|
||||
def item_display(request, pk):
|
||||
if not pk:
|
||||
return render(request, 'results.html', {
|
||||
|
@ -76,10 +82,12 @@ def item_display(request, pk):
|
|||
'children': item.get_children().prefetch_related('categories'),
|
||||
})
|
||||
|
||||
|
||||
def label_lookup(request, pk):
|
||||
label = get_object_or_404(Label, pk=pk)
|
||||
return redirect(label.item)
|
||||
|
||||
|
||||
class ItemSelectView(AutoResponseView):
|
||||
def get(self, request, *args, **kwargs):
|
||||
self.widget = self.get_widget_or_404()
|
||||
|
|
Loading…
Reference in New Issue