繁体   English   中英

TypeError:'instancemethod'类型的对象没有len()

[英]TypeError: object of type 'instancemethod' has no 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

我想我在这里删除了一些东西,这就是我收到错误的原因

你忘了把()

 envelopes = Envelope.objects.filter(user=request.user).exclude_unallocated()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM