title: django didn't return HttpResponse Object
body: <p>I saw many answers about this subject of HttpResponse object in Django, but i can't resolve it.
  Normally, the user enters the information and the database is saved.
  But this is not happening since I get this error. Is there that can help?</p>
  <pre><code>def place_order(request, total=0, quantity=0):
      current_user = request.user
  
      # If the cart count is less than or equal to 0, then redirect back to shop
      cart_items = CartItem.objects.filter(user=current_user)
      cart_count = cart_items.count()
      if cart_count &lt;= 0:
          return redirect(&quot;store&quot;)
  
      grand_total = 0
      tax = 0
      for cart_item in cart_items:
          total += cart_item.product.price * cart_item.quantity
          quantity += cart_item.quantity
      tax = (2 * total) / 100
      grand_total = total + tax
  
      # ---
  
      if request.method == &quot;POST&quot;:
          form = OrderForm(request.POST)
          if form.is_valid():
              # Store all the billing information inside Order table
              data = Order()
              data.user = current_user
              data.first_name = form.cleaned_data[&quot;first_name&quot;]
              data.last_name = form.cleaned_data[&quot;last_name&quot;]
              data.phone = form.cleaned_data[&quot;phone&quot;]
              data.email = form.cleaned_data[&quot;email&quot;]
              data.address_line_1 = form.cleaned_data[&quot;address_line_1&quot;]
              data.address_line_2 = form.cleaned_data[&quot;address_line_2&quot;]
              data.country = form.cleaned_data[&quot;country&quot;]
              data.state = form.cleaned_data[&quot;state&quot;]
              data.city = form.cleaned_data[&quot;city&quot;]
              data.order_note = form.cleaned_data[&quot;order_note&quot;]
              data.order_total = grand_total
              data.tax = tax
              data.ip = request.META.get(&quot;REMOTE_ADDR&quot;)
              data.save()
              # Generate order number
              yr = int(datetime.date.today().strftime(&quot;%Y&quot;))
              dt = int(datetime.date.today().strftime(&quot;%d&quot;))
              mt = int(datetime.date.today().strftime(&quot;%m&quot;))
              d = datetime.date(yr, mt, dt)
              current_date = d.strftime(&quot;%Y%m%d&quot;)  # 20210305
              order_number = current_date + str(data.id)
              data.order_number = order_number
              data.save()
              return redirect(&quot;store&quot;)
      else:
          return redirect(&quot;checkout&quot;)
  </code></pre>