forked from 0x2620/pandora
actually return computed values for annotation
This commit is contained in:
parent
a33c7f6325
commit
af61df1f00
1 changed files with 7 additions and 6 deletions
|
@ -127,14 +127,15 @@ class Annotation(models.Model):
|
|||
|
||||
def json(self, layer=False, keys=None):
|
||||
j = {
|
||||
'id': self.public_id,
|
||||
'user': self.user.username,
|
||||
'in': self.start,
|
||||
'out': self.end,
|
||||
'value': self.value,
|
||||
'created': self.created,
|
||||
'modified': self.modified
|
||||
}
|
||||
for field in ('id', 'in', 'out', 'value', 'created', 'modified',
|
||||
'hue', 'saturation', 'lightness', 'volume'):
|
||||
j[field] = getattr(self, {
|
||||
'id': 'public_id',
|
||||
'in': 'start',
|
||||
'out': 'end',
|
||||
}.get(field, field))
|
||||
if layer:
|
||||
j['layer'] = self.layer.name
|
||||
if keys:
|
||||
|
|
Loading…
Reference in a new issue