From 520650d53bab5ce17e19064cd72138099931dd31 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Mon, 15 Oct 2012 15:56:08 +0200 Subject: [PATCH] add sortName api --- pandora/person/views.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pandora/person/views.py b/pandora/person/views.py index 88765234c..54157a311 100644 --- a/pandora/person/views.py +++ b/pandora/person/views.py @@ -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]