diff --git a/app/text/models.py b/app/text/models.py index 16b08d3..9849047 100644 --- a/app/text/models.py +++ b/app/text/models.py @@ -60,7 +60,7 @@ class Text(models.Model): elif 'edit' in self.data: return self.get_edit_annotations(api) else: - raise Exception('Text does not have item or edit.') + return [] def get_item_annotations(self, api): query = { @@ -93,7 +93,7 @@ class Text(models.Model): return self.get_clips(api, annotations) def get_clips(self, api, annotations): - item_ids = [annot['id'].split('/')[0] for annot in annotations] + item_ids = {annot['id'].split('/')[0] for annot in annotations} query = { 'itemsQuery': { 'conditions': [{ @@ -133,7 +133,6 @@ class Text(models.Model): self.annotations = annotations super().save(*args, **kwargs) - def json(self): data = {} data['title'] = self.title