dont include null values in lookup

This commit is contained in:
j 2015-02-16 16:12:44 +00:00
parent 484b33e39d
commit 2a63a3b300

View file

@ -714,7 +714,9 @@ def lookup(request, data):
if i: if i:
r = {'id': i.public_id} r = {'id': i.public_id}
for key in ('title', 'director', 'year'): for key in ('title', 'director', 'year'):
r[key] = i.get(key) value = i.get(key)
if value != None:
r[key] = value
response = json_response(r) response = json_response(r)
else: else:
response = json_response(status=404, text='not found') response = json_response(status=404, text='not found')