chnage editEntities argument names, fixes #2594
This commit is contained in:
parent
f3c0f8d76a
commit
3946875188
1 changed files with 9 additions and 9 deletions
|
@ -87,8 +87,8 @@ actions.register(addEntity, cache=False)
|
||||||
def autocompleteEntities(request, data):
|
def autocompleteEntities(request, data):
|
||||||
'''
|
'''
|
||||||
takes {
|
takes {
|
||||||
type: string,
|
key: string,
|
||||||
name: string,
|
value: string,
|
||||||
operator: string // '=', '==', '^', '$'
|
operator: string // '=', '==', '^', '$'
|
||||||
range: [int, int]
|
range: [int, int]
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ def autocompleteEntities(request, data):
|
||||||
data['range'] = [0, 10]
|
data['range'] = [0, 10]
|
||||||
op = data.get('operator', '=')
|
op = data.get('operator', '=')
|
||||||
|
|
||||||
entity = utils.get_by_id(settings.CONFIG['entities'], data['type'])
|
entity = utils.get_by_id(settings.CONFIG['entities'], data['key'])
|
||||||
order_by = entity.get('autocompleteSort', False)
|
order_by = entity.get('autocompleteSort', False)
|
||||||
if order_by:
|
if order_by:
|
||||||
for o in order_by:
|
for o in order_by:
|
||||||
|
@ -110,16 +110,16 @@ def autocompleteEntities(request, data):
|
||||||
else:
|
else:
|
||||||
order_by = '-matches'
|
order_by = '-matches'
|
||||||
|
|
||||||
qs = models.Entity.objects.filter(type=data['type'])
|
qs = models.Entity.objects.filter(type=data['key'])
|
||||||
if data['name']:
|
if data['value']:
|
||||||
if op == '=':
|
if op == '=':
|
||||||
qs = qs.filter(name_find__icontains=data['name'])
|
qs = qs.filter(name_find__icontains=data['value'])
|
||||||
elif op == '==':
|
elif op == '==':
|
||||||
qs = qs.filter(name_find__icontains=u'|%s|'%data['name'])
|
qs = qs.filter(name_find__icontains=u'|%s|'%data['value'])
|
||||||
elif op == '^':
|
elif op == '^':
|
||||||
qs = qs.filter(name_find__icontains=u'|%s'%data['name'])
|
qs = qs.filter(name_find__icontains=u'|%s'%data['value'])
|
||||||
elif op == '$':
|
elif op == '$':
|
||||||
qs = qs.filter(name_find__icontains=u'%s|'%data['name'])
|
qs = qs.filter(name_find__icontains=u'%s|'%data['value'])
|
||||||
qs = qs.order_by(order_by)
|
qs = qs.order_by(order_by)
|
||||||
qs = qs[data['range'][0]:data['range'][1]]
|
qs = qs[data['range'][0]:data['range'][1]]
|
||||||
response = json_response({})
|
response = json_response({})
|
||||||
|
|
Loading…
Reference in a new issue