fix sort of static edits

This commit is contained in:
j 2016-08-23 13:24:08 +02:00
parent 9685c7e4a5
commit 97a46dceb0

View file

@ -174,7 +174,7 @@ def _order_clips(edit, sort):
if operator != '-':
operator = ''
key = e['key']
#fixme, random should be clip random
# fixme, random should be clip random
if key not in ('index', 'in', 'out', 'position', 'hue', 'saturation', 'lightness', 'volume', 'duration', 'text'):
key = "item__sort__%s" % key
key = {
@ -187,6 +187,9 @@ def _order_clips(edit, sort):
order = '%s%s' % (operator, key)
order_by.append(order)
if order_by:
if edit.type == 'static':
qs = qs.order_by(*order_by)
else:
qs = qs.order_by(*order_by, nulls_last=True)
qs = qs.distinct()
return qs