我目前在以下查询中遇到错误。
projects.objects.all()
这是我的代码:
class ProjectManager(models.Manager):
"""A re-usable Manager to access a custom QuerySet"""
def __getattr__(self, attr, *args):
try:
return getattr(self.__class__, attr, *args)
except AttributeError:
return getattr(self.get_query_set(), attr, *args)
def get_query_set(self):
return self.model.QuerySet(self.model)
class Project(models.Model):
objects = ProjectManager()
class QuerySet(QuerySet):
def add_priority(self):
return self.extra(select={"priority": "COALESCE(bm_rank, sales_rank, id)"}, order_by=["priority"])
# return self.filter(*args, **kwargs)
def add_size(self):
return self.extra(select={"size": "order_size_price*order_size_weight"})
new_requests = projects.objects.all()
我不确定为什么会出现这个错误,请帮忙