4
我完成清理我的项目。我删除没有用的应用程序和代码,然后我安排他们。在此之后我遇到了错误TypeError:'instancemethod'类型的对象没有len()
TypeError: object of type 'instancemethod' has no len()
,所以我将其更改为COUNT(),但我再次遇到错误
AttributeError: 'function' object has no attribute 'count'
这里是我的代码:
def budget(request):
envelopes = Envelope.objects.filter(
user=request.user).exclude_unallocated
return render(request, 'budget.html', {
'limit': account_limit(request, 15, envelopes),
}
def account_limit(request, value, query):
count_objects = len(query)
//other codes here
return result
我想我在这里删除的东西这就是为什么我得到错误
我甚至在它工作之前就没有放过(),但我会尝试你的答案 – catherine 2013-02-26 09:17:23
好吧,谢谢它现在正在工作。我只注意到我必须放(),因为我在len中使用它。赶上 – catherine 2013-02-26 09:20:19