sequence duration
This commit is contained in:
parent
72be96fe56
commit
c405d007eb
2 changed files with 3 additions and 1 deletions
|
@ -30,6 +30,7 @@ class Sequence(models.Model):
|
|||
hash = models.CharField(db_index=True, max_length=16, default='')
|
||||
start = models.FloatField(default=-1, db_index=True)
|
||||
end = models.FloatField(default=-1)
|
||||
duration = models.FloatField(default=0)
|
||||
|
||||
objects = managers.SequenceManager()
|
||||
|
||||
|
@ -37,6 +38,7 @@ class Sequence(models.Model):
|
|||
self.public_id = u"%s/%0.03f-%0.03f" % (
|
||||
self.item.itemId, float(self.start), float(self.end)
|
||||
)
|
||||
self.duration = self.end - self.start
|
||||
if self.item:
|
||||
self.user = self.item.user and self.item.user.id
|
||||
self.sort = self.item.sort
|
||||
|
|
|
@ -41,7 +41,7 @@ def order_query(qs, sort):
|
|||
'out': 'end',
|
||||
'position': 'start',
|
||||
}.get(e['key'], e['key'])
|
||||
if key not in ('start', 'end', 'mode', 'hash'):
|
||||
if key not in ('duration', 'start', 'end', 'mode', 'hash'):
|
||||
key = 'sort__%s' % key
|
||||
order = '%s%s' % (operator, key)
|
||||
order_by.append(order)
|
||||
|
|
Loading…
Reference in a new issue