find local ids
This commit is contained in:
parent
dadf1af1e6
commit
1594bec79e
1 changed files with 9 additions and 15 deletions
|
@ -369,21 +369,15 @@ def findId(request):
|
||||||
data = json.loads(request.POST['data'])
|
data = json.loads(request.POST['data'])
|
||||||
response = json_response({})
|
response = json_response({})
|
||||||
response['data']['items'] = []
|
response['data']['items'] = []
|
||||||
'''
|
if 'id' in data:
|
||||||
FIXME: can not handle query for director []
|
qs = models.Item.objects.filter(itemId=data['id'])
|
||||||
query = parse_query(data, request.user)
|
if qs.count() == 1:
|
||||||
qs = _order_query(query['qs'], query['sort'])
|
response['data']['items'] = [
|
||||||
if qs.count() == 1:
|
i.get_json(['title', 'director', 'year', 'id']) for i in qs
|
||||||
response['data']['items'] = [i.get_json(data['keys']) for i in qs]
|
]
|
||||||
elif settings.DATA_SERVICE:
|
if not response['data']['items'] \
|
||||||
'''
|
and len(data['id']) == 7 \
|
||||||
if settings.DATA_SERVICE:
|
and settings.DATA_SERVICE:
|
||||||
'''
|
|
||||||
info = {}
|
|
||||||
for c in data['query']['conditions']:
|
|
||||||
info[c['key']] = c['value']
|
|
||||||
r = models.external_data('getId', info)
|
|
||||||
'''
|
|
||||||
r = models.external_data('getId', data)
|
r = models.external_data('getId', data)
|
||||||
if r['status']['code'] == 200:
|
if r['status']['code'] == 200:
|
||||||
response['data']['items'] = [r['data']]
|
response['data']['items'] = [r['data']]
|
||||||
|
|
Loading…
Reference in a new issue