When I go to add multiple integer variables, I'm getting below error. Now, what has to do?
Error:
TypeError at /
unsupported operand type(s) for : 'method' and 'int'
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 3.2.3
Exception Type: TypeError
Exception Value:
unsupported operand type(s) for : 'method' and 'int'
views:
total_frontend_order = request.user.user_frontend_order.all().count
total_backend_order = request.user.user_backend_order.all().count
total_complete_website_order = request.user.user_complete_website_order.all().count
a = total_frontend_order 1
CodePudding user response:
You need to write count() With parenthesis.
CodePudding user response:
You need to call the .count()
method [Django-doc], so:
total_frontend_order = request.user.user_frontend_order.all().count()
total_backend_order = request.user.user_backend_order.all().count()
total_complete_website_order = request.user.user_complete_website_order.all().count()
a = total_frontend_order 1