use QuerySet in all managers

This commit is contained in:
j 2014-01-07 11:05:42 +00:00
commit 5b72a33a95
7 changed files with 10 additions and 7 deletions

View file

@ -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):
'''

View file

@ -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