[Answer]-Dealing with a valueError

1👍

Update your view code to adding new item as

if not item_in_orders:
    # creat and save a new order item
    oi = OrderItem()
    oi.quantity = quantity
    oi.order_id = _order_id(request)
    oi.save()
    #save oi first, then add i to item
    oi.item.add(i)
👤Rohan

Leave a comment