title: Information stored in session not saving django
body: <p>I've been having trouble with storing my data in django. I'm appending a tuple but everytime I do a post request it shows me an empty array. It should be appending every time? Can anyone give me an idea on why this happens? (my forms and data are working fine the information is received in request.POST) </p>
  
  <p><strong>views.py</strong></p>
  
  <p>The session is started when a user logs in </p>
  
  <pre><code>    def post(request):
      username = request.POST["username"]
      password = request.POST["password"]
  
      user = authenticate(username=username, password=password)
  
      if user is not None:
          login(request, user)
          request.session['cart'] = []
          return redirect("/")
      else:
          return render(request, 'sign_in.html', {
              "error": "Invalid Credentials"
          })
  </code></pre>
  
  <p>now heres where the problems at</p>
  
  <p>get method (class based view)</p>
  
  <pre><code> def get(request):
      stalls = available_stalls()
      products = Product.objects.all()
  
      if 'cart' not in request.session:
          request.session['cart'] = []
          cart_count = 0
      else:
          cart_count = len(request.session['cart'])
  
      context = {
          "stalls": stalls,
          "products": products,
          'cart_count': cart_count
      }
  
      if request.user.is_authenticated:
          user = request.user
          customer = Customer.objects.filter(user=user)[0]
          full_name = customer.full_name
          context["name"] = full_name
  
      return render(request, 'product_catalog.html', context)
  </code></pre>
  
  <p>post method (class based view)</p>
  
  <pre><code>    def post(request):
  
      if "product" not in request.POST or "quantity" not in request.POST:
          raise Http404("Product or quantity not in POST data")
  
      product_id = request.POST["product"]
      quantity = request.POST["quantity"]
  
      try:
          product = Product.objects.get(id=product_id)
      except:
          raise Http404("Product ID not in database")
  
  
      print(request.session["cart"])
      request.session["cart"].append((product, quantity))
      cart_count = len(request.session['cart'])
  
  
      stalls = available_stalls()
      products = Product.objects.all()
  
      # TODO: Compute recommendations
      return render(request, 'product_catalog.html', {
          'added_to_cart': product,
          'cart_count': cart_count,
          'quantity': quantity,
          'stalls': stalls,
          'products': products
      })
  </code></pre>