title: Django Cart Model with products - implementing quantity of items
body: <p>I've got a Cart, Product and a Entry model. What I'm trying to do is giving users the option to put more then one item in the cart and displaying the quantity in the checkout. 
  I can get the chosen quantity over     </p>
  
  <pre><code>quantity_input= request.POST.get('quantity-field')
  </code></pre>
  
  <p>and create a new Entry object within the cart_update()</p>
  
  <pre><code>Entry.objects.create(cart=cart_obj, product=product_obj, quantity=quantity_form)
  </code></pre>
  
  <p>which knows what cart and product it belongs to. 
  But then I hit a wall in outputting it over the view since I'm only having a cart_obj as context not knowing how to also render the entry object in addition. </p>
  
  <h2>Cart Model:</h2>
  
  <pre><code>class Cart(models.Model):
          user        = models.ForeignKey(User, null=True, blank=True)
          products    = models.ManyToManyField(Product, blank=True)
          subtotal    = models.DecimalField(default=0.00, decimal_places=2, max_digits=100)
          total       = models.DecimalField(default=0.00, decimal_places=2, max_digits=100)    
          count       = models.PositiveIntegerField(default=0)
  
          objects = CartManager()
  </code></pre>
  
  <h2>Entry Model</h2>
  
  <pre><code>class Entry(models.Model):
          product = models.ForeignKey(Product, null=True)
          eCart = models.ForeignKey(Cart, null=True)
          quantity = models.PositiveIntegerField()
  
  @receiver(post_save, sender=Entry)
      def update_cart(sender, instance, **kwargs):
          line_cost = instance.quantity * instance.product.price
          instance.cart.count = int(instance.cart.count) + int(instance.quantity)
  </code></pre>
  
  <h2>carts views.py</h2>
  
  <pre><code>def cart_update(request):
      product_id = request.POST.get('product_id')
      quantity_input= request.POST.get('quantity-field')
  
      if product_id is not None:            
          cart_obj, new_obj = Cart.objects.new_or_get(request)
          Entry.objects.create(cart=cart_obj, product=product_obj, quantity=quantity_input)
          cart_obj.products.add(product_obj)            
          added = True
          request.session['cart_items'] = cart_obj.products.count()        
      return redirect("carts:home")
  
  def cart_home(request):
      cart_obj, new_obj = Cart.objects.new_or_get(request)
      return render(request, "carts/home.html",{"cart":cart_obj})
  </code></pre>
  
  <p>Thanks for help.</p>