diff -r f01235a1dcc2 -r f9a7cc377689 src/hdalab/views/ajax.py --- a/src/hdalab/views/ajax.py Thu Jun 26 10:44:05 2014 +0200 +++ b/src/hdalab/views/ajax.py Thu Jun 26 12:13:41 2014 +0200 @@ -219,20 +219,19 @@ res = [] for t in qslist: - dbfields = t.dbpedia_fields - resobj = {'original_label':t.label,'nb':t.nb} - resobj['thumbnail'] = dbfields.thumbnail if dbfields is not None else None - -# if t.id in translations and not translations[t.id].get('is_label_translated', True): -# continue - if t.id in translations: - resobj['value'] = translations[t.id]['label'] - resobj['abstract'] = translations[t.id]['abstract'] - else: - resobj['value'] = t.label - resobj['abstract'] = dbfields.abstract if dbfields is not None else None - if q is None or resobj['value'].lower().find(lq) != -1: - res.append(resobj) + if hasattr(t, 'dbpedia_fields'): + dbfields = t.dbpedia_fields + resobj = {'original_label':t.label,'nb':t.nb} + resobj['thumbnail'] = dbfields.thumbnail if dbfields is not None else None + + if t.id in translations: + resobj['value'] = translations[t.id]['label'] + resobj['abstract'] = translations[t.id]['abstract'] + else: + resobj['value'] = t.label + resobj['abstract'] = dbfields.abstract if dbfields is not None else None + if q is None or resobj['value'].lower().find(lq) != -1: + res.append(resobj) return HttpResponse(content=json.dumps(res), mimetype='application/json')