forked from 0x2620/pandora
use getIds from dataservice
This commit is contained in:
parent
71209541ed
commit
b251332fc9
1 changed files with 28 additions and 4 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue