From b251332fc9b4abb8f17567eb3acbd4e368db2a43 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Thu, 28 Feb 2013 10:34:14 +0000 Subject: [PATCH] use getIds from dataservice --- pandora/item/views.py | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/pandora/item/views.py b/pandora/item/views.py index b2b1d48a1..6aa353450 100644 --- a/pandora/item/views.py +++ b/pandora/item/views.py @@ -360,11 +360,11 @@ actions.register(autocomplete) def findId(request): ''' param data { - 'query': query, - 'sort': array, - 'range': array + 'id': + 'title': + 'director': [] + 'year': ... } - ''' data = json.loads(request.POST['data']) response = json_response({}) @@ -418,6 +418,30 @@ def getMetadata(request): return render_to_json_response(response) actions.register(getMetadata) +def getIds(request): + ''' + param data { + title: '', + director: [], + year: int + } + + returns { + items: [{tite, director, year, originalTitle}, ...] + } + + ''' + data = json.loads(request.POST['data']) + response = json_response({}) + if settings.DATA_SERVICE: + r = models.external_data('getIds', data) + if r['status']['code'] == 200: + response['data']['items'] = r['data']['items'] + else: + response['data']['items'] + return render_to_json_response(response) +actions.register(getIds) + def get(request): ''' param data {