Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: object of type 'instancemethod' has no len()

Tags:

python

django

I'm finish cleaning my project. I remove not useful apps and codes then I arrange them. After this I encountered error

TypeError: object of type 'instancemethod' has no len()

so I change it to count() but I encountered error again

AttributeError: 'function' object has no attribute 'count'

Here is my code:

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

I think I delete something here that's why I'm getting the error

like image 211
catherine Avatar asked Dec 26 '22 08:12

catherine


1 Answers

You forgot to put ()

 envelopes = Envelope.objects.filter(user=request.user).exclude_unallocated()
like image 188
princess Avatar answered Dec 28 '22 22:12

princess