yolo
This commit is contained in:
parent
cbc3a79138
commit
b8677eebec
|
@ -10,10 +10,6 @@
|
||||||
<button class="btn btn-primary" type="submit"><i class="glyphicon glyphicon-search"></i></button>
|
<button class="btn btn-primary" type="submit"><i class="glyphicon glyphicon-search"></i></button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<!-- <div class="text-right"> -->
|
|
||||||
<!-- <input type="checkbox" id="smartsearch" name="smartsearch"> -->
|
|
||||||
<!-- <label for="smartsearch">SmartSearch</label> -->
|
|
||||||
<!-- </div> -->
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -5,7 +5,6 @@ from django.contrib.postgres.search import SearchVector, TrigramSimilarity
|
||||||
from django.http import Http404, JsonResponse
|
from django.http import Http404, JsonResponse
|
||||||
from django.contrib.admin.models import LogEntry
|
from django.contrib.admin.models import LogEntry
|
||||||
from django_select2.views import AutoResponseView
|
from django_select2.views import AutoResponseView
|
||||||
from django.db.models import Q
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
|
||||||
from storage.models import Item, Label
|
from storage.models import Item, Label
|
||||||
|
@ -122,7 +121,11 @@ class PropSelectView(AutoResponseView):
|
||||||
self.term = kwargs.get('term', request.GET.get('term', ''))
|
self.term = kwargs.get('term', request.GET.get('term', ''))
|
||||||
# context = self.get_context_data()
|
# context = self.get_context_data()
|
||||||
with connection.cursor() as c:
|
with connection.cursor() as c:
|
||||||
c.execute("select e from (select skeys(props) as e, count(skeys(props)) as e_count from storage_item group by e order by e_count desc) as xD where e like %s limit 10;", ['%' + self.term + '%'])
|
c.execute("""
|
||||||
|
select e from (
|
||||||
|
select skeys(props) as e, count(skeys(props)) as e_count
|
||||||
|
from storage_item group by e order by e_count desc) as xD
|
||||||
|
where e like %s limit 10;""", ['%' + self.term + '%'])
|
||||||
props = c.fetchall()
|
props = c.fetchall()
|
||||||
|
|
||||||
return JsonResponse({
|
return JsonResponse({
|
||||||
|
|
|
@ -66,10 +66,5 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
django.jQuery('a.hs-add-row').on('click', console.log);
|
|
||||||
django.jQuery(function() { initDjangoHStoreWidget('{{ field_name }}') });
|
django.jQuery(function() { initDjangoHStoreWidget('{{ field_name }}') });
|
||||||
|
|
||||||
// function(e) {
|
|
||||||
// $('.django-select2').select2();
|
|
||||||
// });
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue