actually return computed values for annotation

This commit is contained in:
j 2011-09-30 16:16:11 +02:00
parent a33c7f6325
commit af61df1f00

View file

@ -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: