Py学习  »  Django

如何在django视图中进行加法?

Mossaddak Sium • 4 年前 • 2061 次点击  

当我去添加多个整数变量时,我得到了下面的错误。现在,我们该怎么办?

错误:

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'

意见:

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
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/130770
文章 [ 2 ]  |  最新文章 4 年前