From 5b72a33a95e34772c02ac2af78561883b9de8bfd Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 7 Jan 2014 11:05:42 +0000 Subject: [PATCH] use QuerySet in all managers --- pandora/edit/managers.py | 4 +++- pandora/edit/views.py | 2 +- pandora/item/managers.py | 1 - pandora/itemlist/managers.py | 3 ++- pandora/itemlist/views.py | 2 +- pandora/text/managers.py | 3 ++- pandora/text/views.py | 2 +- 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/pandora/edit/managers.py b/pandora/edit/managers.py index 4e06e1e4..796f3b30 100644 --- a/pandora/edit/managers.py +++ b/pandora/edit/managers.py @@ -2,6 +2,8 @@ # vi:si:et:sw=4:sts=4:ts=4 from django.db.models import Q, Manager +from ox.django.query import QuerySet + def parseCondition(condition, user): ''' @@ -92,7 +94,7 @@ def parseConditions(conditions, operator, user): class EditManager(Manager): def get_query_set(self): - return super(EditManager, self).get_query_set() + return QuerySet(self.model) def find(self, data, user): ''' diff --git a/pandora/edit/views.py b/pandora/edit/views.py index ded499ae..62a15013 100644 --- a/pandora/edit/views.py +++ b/pandora/edit/views.py @@ -172,7 +172,7 @@ def _order_clips(qs, sort): order = '%s%s' % (operator, key) order_by.append(order) if order_by: - qs = qs.order_by(*order_by) + qs = qs.order_by(*order_by, nulls_last=True) qs = qs.distinct() return qs diff --git a/pandora/item/managers.py b/pandora/item/managers.py index f0093266..8df83440 100644 --- a/pandora/item/managers.py +++ b/pandora/item/managers.py @@ -257,7 +257,6 @@ def parseConditions(conditions, operator, user, owner=None): class ItemManager(Manager): def get_query_set(self): - #return super(ItemManager, self).get_query_set() return QuerySet(self.model) def filter_list(self, qs, l, user): diff --git a/pandora/itemlist/managers.py b/pandora/itemlist/managers.py index 344ea341..b37a9148 100644 --- a/pandora/itemlist/managers.py +++ b/pandora/itemlist/managers.py @@ -3,6 +3,7 @@ from django.db.models import Q, Manager +from ox.django.query import QuerySet def parseCondition(condition, user): ''' @@ -93,7 +94,7 @@ def parseConditions(conditions, operator, user): class ListManager(Manager): def get_query_set(self): - return super(ListManager, self).get_query_set() + return QuerySet(self.model) def find(self, data, user): ''' diff --git a/pandora/itemlist/views.py b/pandora/itemlist/views.py index 88952448..a509e993 100644 --- a/pandora/itemlist/views.py +++ b/pandora/itemlist/views.py @@ -40,7 +40,7 @@ def _order_query(qs, sort): if key == 'subscribers': qs = qs.annotate(subscribers=Sum('subscribed_users')) if order_by: - qs = qs.order_by(*order_by) + qs = qs.order_by(*order_by, nulls_last=True) qs = qs.distinct() return qs diff --git a/pandora/text/managers.py b/pandora/text/managers.py index 23e03fd1..6598d556 100644 --- a/pandora/text/managers.py +++ b/pandora/text/managers.py @@ -2,6 +2,7 @@ # vi:si:et:sw=4:sts=4:ts=4 from django.db.models import Q, Manager +from ox.django.query import QuerySet def parseCondition(condition, user): ''' @@ -92,7 +93,7 @@ def parseConditions(conditions, operator, user): class TextManager(Manager): def get_query_set(self): - return super(TextManager, self).get_query_set() + return QuerySet(self.model) def find(self, data, user): ''' diff --git a/pandora/text/views.py b/pandora/text/views.py index 4da5c1ff..4e3abceb 100644 --- a/pandora/text/views.py +++ b/pandora/text/views.py @@ -165,7 +165,7 @@ def _order_query(qs, sort): if key == 'subscribers': qs = qs.annotate(subscribers=Sum('subscribed_users')) if order_by: - qs = qs.order_by(*order_by) + qs = qs.order_by(*order_by, nulls_last=True) qs = qs.distinct() return qs