From 3fb3c6ef38430cc0f7f5004503fd79f565a9946e Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sun, 18 Dec 2011 15:17:12 +0530 Subject: [PATCH] only update if clip is set --- pandora/annotation/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index ef453897a..009c03ffe 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -45,7 +45,7 @@ class Annotation(models.Model): return False def html(self): - if self.layer.type == 'string': + if self.layer == 'string': return utils.html_parser(self.value) else: return self.value @@ -83,10 +83,11 @@ class Annotation(models.Model): if set_public_id: self.set_public_id() - Clip.objects.filter(**{ - 'id': self.clip.id, - self.layer: False - }).update(**{self.layer: True}) + if self.clip: + Clip.objects.filter(**{ + 'id': self.clip.id, + self.layer: False + }).update(**{self.layer: True}) #how expensive is this? #update_matching_events.delay(self.value)