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)
Source:stackexchange.com