set words/clips only if id exists

This commit is contained in:
j 2013-05-12 14:20:55 +02:00
parent f0acbd2bef
commit dd49b61a59

View file

@ -811,6 +811,7 @@ class Item(models.Model):
s.rightslevel = self.level
s.aspectratio = self.get('aspectratio')
if self.id:
s.words = sum([len(a.value.split()) for a in self.annotations.exclude(value='')])
s.clips = self.clips.count()