From 15fb864d7453ea43b8de77cc6c85b67b96e83e12 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 16 Dec 2014 15:21:24 +0000 Subject: [PATCH] get entity by id after all --- pandora/annotation/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 64bf7455..24446ca9 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -226,10 +226,10 @@ class Annotation(models.Model): j['languages'] = self.languages.split(',') l = self.get_layer() if l['type'] == 'entity': - entity = Entity.get_by_name(self.value) - if entity > 0: + try: + entity = Entity.get(self.value) j['entity'] = entity.json(user=user) - else: + except: j['entity'] = {} elif l['type'] == 'event': qs = self.events.all()