use QuerySet in all managers
This commit is contained in:
parent
0e55faca0d
commit
5b72a33a95
7 changed files with 10 additions and 7 deletions
|
@ -2,6 +2,8 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
||||||
|
from ox.django.query import QuerySet
|
||||||
|
|
||||||
|
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
'''
|
'''
|
||||||
|
@ -92,7 +94,7 @@ def parseConditions(conditions, operator, user):
|
||||||
class EditManager(Manager):
|
class EditManager(Manager):
|
||||||
|
|
||||||
def get_query_set(self):
|
def get_query_set(self):
|
||||||
return super(EditManager, self).get_query_set()
|
return QuerySet(self.model)
|
||||||
|
|
||||||
def find(self, data, user):
|
def find(self, data, user):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -172,7 +172,7 @@ def _order_clips(qs, sort):
|
||||||
order = '%s%s' % (operator, key)
|
order = '%s%s' % (operator, key)
|
||||||
order_by.append(order)
|
order_by.append(order)
|
||||||
if order_by:
|
if order_by:
|
||||||
qs = qs.order_by(*order_by)
|
qs = qs.order_by(*order_by, nulls_last=True)
|
||||||
qs = qs.distinct()
|
qs = qs.distinct()
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,6 @@ def parseConditions(conditions, operator, user, owner=None):
|
||||||
class ItemManager(Manager):
|
class ItemManager(Manager):
|
||||||
|
|
||||||
def get_query_set(self):
|
def get_query_set(self):
|
||||||
#return super(ItemManager, self).get_query_set()
|
|
||||||
return QuerySet(self.model)
|
return QuerySet(self.model)
|
||||||
|
|
||||||
def filter_list(self, qs, l, user):
|
def filter_list(self, qs, l, user):
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
||||||
|
from ox.django.query import QuerySet
|
||||||
|
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
'''
|
'''
|
||||||
|
@ -93,7 +94,7 @@ def parseConditions(conditions, operator, user):
|
||||||
class ListManager(Manager):
|
class ListManager(Manager):
|
||||||
|
|
||||||
def get_query_set(self):
|
def get_query_set(self):
|
||||||
return super(ListManager, self).get_query_set()
|
return QuerySet(self.model)
|
||||||
|
|
||||||
def find(self, data, user):
|
def find(self, data, user):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -40,7 +40,7 @@ def _order_query(qs, sort):
|
||||||
if key == 'subscribers':
|
if key == 'subscribers':
|
||||||
qs = qs.annotate(subscribers=Sum('subscribed_users'))
|
qs = qs.annotate(subscribers=Sum('subscribed_users'))
|
||||||
if order_by:
|
if order_by:
|
||||||
qs = qs.order_by(*order_by)
|
qs = qs.order_by(*order_by, nulls_last=True)
|
||||||
qs = qs.distinct()
|
qs = qs.distinct()
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
# vi:si:et:sw=4:sts=4:ts=4
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
from django.db.models import Q, Manager
|
from django.db.models import Q, Manager
|
||||||
|
|
||||||
|
from ox.django.query import QuerySet
|
||||||
|
|
||||||
def parseCondition(condition, user):
|
def parseCondition(condition, user):
|
||||||
'''
|
'''
|
||||||
|
@ -92,7 +93,7 @@ def parseConditions(conditions, operator, user):
|
||||||
class TextManager(Manager):
|
class TextManager(Manager):
|
||||||
|
|
||||||
def get_query_set(self):
|
def get_query_set(self):
|
||||||
return super(TextManager, self).get_query_set()
|
return QuerySet(self.model)
|
||||||
|
|
||||||
def find(self, data, user):
|
def find(self, data, user):
|
||||||
'''
|
'''
|
||||||
|
|
|
@ -165,7 +165,7 @@ def _order_query(qs, sort):
|
||||||
if key == 'subscribers':
|
if key == 'subscribers':
|
||||||
qs = qs.annotate(subscribers=Sum('subscribed_users'))
|
qs = qs.annotate(subscribers=Sum('subscribed_users'))
|
||||||
if order_by:
|
if order_by:
|
||||||
qs = qs.order_by(*order_by)
|
qs = qs.order_by(*order_by, nulls_last=True)
|
||||||
qs = qs.distinct()
|
qs = qs.distinct()
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue