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 4e06e1e4b..796f3b309 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 ded499aed..62a150134 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 f00932667..8df834404 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 344ea3410..b37a91484 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 88952448a..a509e9934 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 23e03fd13..6598d556e 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 4da5c1ffb..4e3abcebe 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