```
def post(self, request):
user = UserProfile.objects.get(username=request.user)
new_goods = Goods(goods_user=user)
goods_from = DaikouForm(
request.POST, instance=new_goods)
if goods_from.is_valid():
goods_from.save()
goods = Goods.object.get(id=
new_goods.id)
try:
cart = Cart.object.get(cart_id=_cart_id)
except Cart.DoseNotExist:
cart = Cart.object.create(
cart_id = _cart_id(request)
)
cart.save(),
try:
cart_item = CartItem.object.get(goods=goods, cart=cart)
cart_item.quantity += 1
cart_item.save()
except CartItem.DoseNotExist:
cart_item = CartItem.object.create(
goods = goods,
quantity = 1,
cart = cart
)
cart_item.save()
return redirect('cart:cart_detail')
else:
goods_from =DaikouForm()
return redirect('index')
```