diff --git a/pandora/item/views.py b/pandora/item/views.py index b2b1d48a..6aa35345 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 {