In django, views here i ran into a problem that my varible called created{"created" is not accessed} so plz see my code and tell me answer

I am just showing my views.py because problem is just here after at third line after order.

def cart(request):

customer = request.user.customer
order, created = Order.objects.get_or_create(customer=customer, complete=False)
items = order.orderitem_set.all()

  
context = {'items':items}
return render(request, 'store/cart.html', context)

Here ,i also dont know that why we use a word like created, what is its purpose.Thanks.

Blockquote

There is a typo in third line. You did:

items = order.orderitem_set.all()

when it should be:

items =**O**rder.orderitem_set.all()
Back to Top