模块'对象不可调用(/ add / 2 /中的TypeError)

时间:2019-06-24 11:20:28

标签: python django

我在按添加到购物车按钮时遇到此问题,请帮助...

from HomePage import Mycart //its directory in homepage app
# from .Mycart import Mycart  
from .models import Product
from .models import Category

@require_POST
def cart_add(request, product_id):
//the line bellow is an error destination line ////

    cart_var = Mycart(request)  # create a new cart object passing it the request object 

    product = get_object_or_404(Product, id=product_id) 
    form = CartAddProductForm(request.POST)
    if form.is_valid():
        cd = form.cleaned_data
        cart_var.add(product=product, quantity=cd['quantity'], update_quantity=cd['update'])
    return redirect('pages:checkout')

错误就在这里

  

模块的对象不可调用

0 个答案:

没有答案