From 6df7d00d11109c25c3f3c7b754ea5e5a3f8a0236 Mon Sep 17 00:00:00 2001 From: Sanj Date: Tue, 1 Nov 2011 00:19:02 +0000 Subject: [PATCH] search multiple words highlight + double result when object_id is in url --- itf/app/models.py | 22 ++++++++++++---------- itf/static/js/insidepage.js | 4 +++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/itf/app/models.py b/itf/app/models.py index c14324c..5b52b64 100755 --- a/itf/app/models.py +++ b/itf/app/models.py @@ -274,6 +274,18 @@ class ItfModel(models.Model): operator = '' sort = operator + s['key'] qset = qset.order_by(sort) + + + #FIXME: object_id needs to do something more graceful, this breaks sort. + if options['object_id'] != False and options['object_id'] != '': + object_id = options['object_id'] + qset = qset.exclude(pk=object_id) + try: + obj = kls.objects.get(pk=object_id) + ret.append(obj.list_dict()) + except: + pass + ''' r0 = options['range'][0] r1 = options['range'][1] @@ -290,16 +302,6 @@ class ItfModel(models.Model): for r in results.object_list: ret.append(r.list_dict()) - #FIXME: object_id needs to do something more graceful, this breaks sort. - if options['object_id'] != False and options['object_id'] != '': - object_id = options['object_id'] - qset = qset.exclude(pk=object_id) - try: - obj = kls.objects.get(pk=object_id) - ret.append(obj.list_dict()) - except: - pass - return { 'page_no': page_no, diff --git a/itf/static/js/insidepage.js b/itf/static/js/insidepage.js index fa07ce7..22371d1 100755 --- a/itf/static/js/insidepage.js +++ b/itf/static/js/insidepage.js @@ -25,7 +25,9 @@ $('#listLeft ul li a').live("click", function() { var searchTerm = $('.searchListField').val(); var html = data.html; if (searchTerm != '') { - html = highlightWordsNoCase(html, searchTerm); + for (var i=0; i" + searchTerm + ""); } $('#bottomRight').html(html);