list films cited
This commit is contained in:
parent
d1e1f311f0
commit
6764d53403
3 changed files with 66 additions and 11 deletions
|
|
@ -97,18 +97,28 @@ class Text(models.Model):
|
|||
return []
|
||||
clips = r['data']['clips']
|
||||
annotations = []
|
||||
cited = {}
|
||||
layer = self.data.get('layer', None) or DEFAULT_LAYER
|
||||
for clip in clips:
|
||||
item_id = clip['item']
|
||||
cited[item_id] = {
|
||||
'title': clip['title'],
|
||||
'director': clip['director'],
|
||||
'id': item_id,
|
||||
}
|
||||
for annotation in clip['layers'][layer]:
|
||||
if 'user' in self.data and annotation['user'] == self.data['user']:
|
||||
continue
|
||||
annotation['title'] = clip['title']
|
||||
for key in ('title', 'director', 'date'):
|
||||
if key in clip:
|
||||
annotation[key] = clip[key]
|
||||
if self.data.get('only_e'):
|
||||
if annotation['value'].startswith('E:'):
|
||||
annotation['value'] = annotation['value'][2:].strip()
|
||||
annotations.append(annotation)
|
||||
elif not annotation['value'].startswith('E:'):
|
||||
annotations.append(annotation)
|
||||
self.data['cited'] = list(cited.values())
|
||||
return self.get_clips(api, annotations)
|
||||
|
||||
def get_clips(self, api, annotations):
|
||||
|
|
@ -158,6 +168,7 @@ class Text(models.Model):
|
|||
data['title'] = self.title
|
||||
data['byline'] = self.byline
|
||||
data['body'] = self.body
|
||||
data['language'] = self.language
|
||||
item_id = self.data.get('related')
|
||||
if not item_id:
|
||||
item_id = self.data.get('item')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue