use QuerySet in all managers

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

View file

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

View file

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

View file

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

View file

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

View file

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

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