get entity by id after all

This commit is contained in:
j 2014-12-16 15:21:24 +00:00
parent 61bf668957
commit 15fb864d74

View file

@ -226,10 +226,10 @@ class Annotation(models.Model):
j['languages'] = self.languages.split(',') j['languages'] = self.languages.split(',')
l = self.get_layer() l = self.get_layer()
if l['type'] == 'entity': if l['type'] == 'entity':
entity = Entity.get_by_name(self.value) try:
if entity > 0: entity = Entity.get(self.value)
j['entity'] = entity.json(user=user) j['entity'] = entity.json(user=user)
else: except:
j['entity'] = {} j['entity'] = {}
elif l['type'] == 'event': elif l['type'] == 'event':
qs = self.events.all() qs = self.events.all()