sort clips
This commit is contained in:
parent
ce8e012fc3
commit
bb728c9369
2 changed files with 7 additions and 2 deletions
|
@ -50,13 +50,14 @@ class Clip(models.Model):
|
|||
|
||||
def json(self, keys=None):
|
||||
j = {}
|
||||
clip_keys = ('id', 'in', 'out', 'created', 'modified',
|
||||
clip_keys = ('id', 'in', 'out', 'position', 'created', 'modified',
|
||||
'hue', 'saturation', 'lightness', 'volume')
|
||||
for key in clip_keys:
|
||||
j[key] = getattr(self, {
|
||||
'id': 'public_id',
|
||||
'in': 'start',
|
||||
'out': 'end',
|
||||
'position': 'start',
|
||||
}.get(key, key))
|
||||
if keys:
|
||||
for key in j.keys():
|
||||
|
|
|
@ -31,9 +31,13 @@ def order_query(qs, sort):
|
|||
operator = e['operator']
|
||||
if operator != '-':
|
||||
operator = ''
|
||||
clip_keys = ('start', 'end', 'hue', 'saturation', 'lightness', 'volume'
|
||||
'annotations__value')
|
||||
key = {
|
||||
'in': 'start',
|
||||
'out': 'end',
|
||||
'position': 'start',
|
||||
'text': 'annotations__value',
|
||||
}.get(e['key'], e['key'])
|
||||
if key.startswith('clip:'):
|
||||
key = e['key'][len('clip:'):]
|
||||
|
@ -41,7 +45,7 @@ def order_query(qs, sort):
|
|||
'text': 'annotations__value',
|
||||
'position': 'start',
|
||||
}.get(key, key)
|
||||
elif key not in ('start', 'end', 'annotations__value'):
|
||||
elif key not in clip_keys:
|
||||
#key mgith need to be changed, see order_sort in item/views.py
|
||||
key = "item__sort__%s" % key
|
||||
order = '%s%s' % (operator, key)
|
||||
|
|
Loading…
Reference in a new issue