make ids unique, don't throw execption, store empty annotations
This commit is contained in:
parent
435b6965b7
commit
6d954c79dd
1 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue