find local ids

This commit is contained in:
j 2013-02-25 13:30:42 +00:00
parent dadf1af1e6
commit 1594bec79e

View file

@ -369,21 +369,15 @@ def findId(request):
data = json.loads(request.POST['data'])
response = json_response({})
response['data']['items'] = []
'''
FIXME: can not handle query for director []
query = parse_query(data, request.user)
qs = _order_query(query['qs'], query['sort'])
if qs.count() == 1:
response['data']['items'] = [i.get_json(data['keys']) for i in qs]
elif settings.DATA_SERVICE:
'''
if settings.DATA_SERVICE:
'''
info = {}
for c in data['query']['conditions']:
info[c['key']] = c['value']
r = models.external_data('getId', info)
'''
if 'id' in data:
qs = models.Item.objects.filter(itemId=data['id'])
if qs.count() == 1:
response['data']['items'] = [
i.get_json(['title', 'director', 'year', 'id']) for i in qs
]
if not response['data']['items'] \
and len(data['id']) == 7 \
and settings.DATA_SERVICE:
r = models.external_data('getId', data)
if r['status']['code'] == 200:
response['data']['items'] = [r['data']]