From 875cbbeaa7f844e890ef4b473d2562b3f9fa3388 Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Fri, 7 Feb 2014 06:47:06 +0000 Subject: [PATCH] clip order --- pandora/edit/managers.py | 4 ++++ pandora/edit/models.py | 2 ++ pandora/edit/views.py | 4 +--- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/pandora/edit/managers.py b/pandora/edit/managers.py index 796f3b30..cb6b9b78 100644 --- a/pandora/edit/managers.py +++ b/pandora/edit/managers.py @@ -133,3 +133,7 @@ class EditManager(Manager): return qs +class ClipManager(Manager): + + def get_query_set(self): + return QuerySet(self.model) diff --git a/pandora/edit/models.py b/pandora/edit/models.py index f7855e46..d3a5138c 100644 --- a/pandora/edit/models.py +++ b/pandora/edit/models.py @@ -374,6 +374,8 @@ class Clip(models.Model): lightness= models.FloatField(default=0) volume = models.FloatField(default=0) + objects = managers.ClipManager() + def __unicode__(self): if self.annotation: return u'%s' % self.annotation.public_id diff --git a/pandora/edit/views.py b/pandora/edit/views.py index 5d51f6c2..e209f8da 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -175,9 +175,7 @@ def _order_clips(qs, sort): order = '%s%s' % (operator, key) order_by.append(order) if order_by: - #fixme use nulls_last - #qs = qs.order_by(*order_by, nulls_last=True) - qs = qs.order_by(*order_by) + qs = qs.order_by(*order_by, nulls_last=True) qs = qs.distinct() return qs