title: I am trying to display added items to my cart page. But when I render my cart page I get attribute error at /cart/
body: <p>This is a portion of my cart.js file</p>
  <pre><code>function updateUserOrder(productId, action){
      console.log('User is logged in, sending data..')
  
      var url = '/update_item/'
  
      fetch(url, {
          method: 'Post',
          headers:{
              'Content-Type':'application/json',
              'X-CSRFToken':csrftoken, 
          },
          body:JSON.stringify({'productId': productId, 'action':action})
      })
  
      .then((response)=&gt;{
          return response.json()
      })
  
      .then((data)=&gt;{
          console.log('data:', data)
      })
  
  }
  </code></pre>
  <p>This is a function in my 'views.py' file.</p>
  <pre><code>def cart(request):
  
      if request.user.is_authenticated:
          customer = request.user.customer
          order, created = Order.objects.get_or_create(customer=customer, complete=False)
          items = order.orderitem_set.all()
      else:
          items = []
          order = {'get_cart_total':0, 'get_cart_items':0}
      context={'items': items, 'order':order}
      return render(request, 'store/cart.html', context)
  </code></pre>
  <p>models.py</p>
  <pre><code>class Order(models.Model):
      costumer = models.ForeignKey(Costumer, on_delete=models.SET_NULL, blank=True, null=True)
      date_ordered = models.DateTimeField(auto_now_add=True)
      complete = models.BooleanField(default=False, null=True, blank=False)
      transaction_id = models.CharField(max_length=200, null=True)
  
      def __str__(self):
          return str(self.id)
      
      @ property
      def get_cart_total(self):
          orderitems = self.orderitem_set.all()
          total = sum([item.get_total for item in orderitems])
          return total
      
      @ property
      def get_cart_items(self):
          orderitems = self.orderitem_set.all()
          total = sum([item.quantity for item in orderitems])
          return total
  </code></pre>
  <p>I am getting this error. I would appreciate it if someone could help me out here.</p>
  <pre><code>File &quot;C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\site-packages\django\utils\functional.py&quot;, line 225, in inner
      return func(self._wrapped, *args)
  AttributeError: 'User' object has no attribute 'customer'
  [07/Sep/2020 09:15:43] &quot;GET /cart/ HTTP/1.1&quot; 500 70674
  </code></pre>
  <p>I don't think I even have a &quot;User&quot; object. I don't know where this error came from.</p>