add sortName api

This commit is contained in:
j 2012-10-15 15:56:08 +02:00
parent 451577a3f9
commit 520650d53b

View file

@ -37,6 +37,25 @@ def editName(request):
return render_to_json_response(response)
actions.register(editName, cache=False)
def sortName(request):
'''
param data {
'name': name
or
'names': [name, name]
}
can contain any of the allowed keys for name
'''
data = json.loads(request.POST['data'])
names = data.get('names', [])
if 'name' in data:
names.append(data['name'])
response['data'] = {}
for name in names:
response['data'][name] = get_name_sort(name)
return render_to_json_response(response)
actions.register(sortName, cache=False)
def parse_query(data, user):
query = {}
query['range'] = [0, 100]