search multiple words highlight + double result when object_id is in url
This commit is contained in:
parent
3dc5fae64f
commit
6df7d00d11
|
@ -274,6 +274,18 @@ class ItfModel(models.Model):
|
||||||
operator = ''
|
operator = ''
|
||||||
sort = operator + s['key']
|
sort = operator + s['key']
|
||||||
qset = qset.order_by(sort)
|
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]
|
r0 = options['range'][0]
|
||||||
r1 = options['range'][1]
|
r1 = options['range'][1]
|
||||||
|
@ -290,16 +302,6 @@ class ItfModel(models.Model):
|
||||||
for r in results.object_list:
|
for r in results.object_list:
|
||||||
ret.append(r.list_dict())
|
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 {
|
return {
|
||||||
'page_no': page_no,
|
'page_no': page_no,
|
||||||
|
|
|
@ -25,7 +25,9 @@ $('#listLeft ul li a').live("click", function() {
|
||||||
var searchTerm = $('.searchListField').val();
|
var searchTerm = $('.searchListField').val();
|
||||||
var html = data.html;
|
var html = data.html;
|
||||||
if (searchTerm != '') {
|
if (searchTerm != '') {
|
||||||
html = highlightWordsNoCase(html, searchTerm);
|
for (var i=0; i<searchTerm.split(" ").length; i++) {
|
||||||
|
html = highlightWordsNoCase(html, searchTerm.split(" ")[i]);
|
||||||
|
}
|
||||||
// html = html.replace(searchTerm, "<span class='highlight'>" + searchTerm + "</span>");
|
// html = html.replace(searchTerm, "<span class='highlight'>" + searchTerm + "</span>");
|
||||||
}
|
}
|
||||||
$('#bottomRight').html(html);
|
$('#bottomRight').html(html);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user