title: 'CheckoutView' object has no attribute 'object'
body: <p>I am getting no attribute 'object' error'</p>
  
  <p>here is views.py</p>
  
  <pre><code>class CheckoutView(FormMixin , DetailView):
      model = Cart
      template_name = "carts/checkout_view.html"
      form_class = GuestCheckoutForm
  
  
      def get_object(self , *args , **kwargs):
          if self.request.user.is_authenticated():
              try:
                  cart = Cart.objects.get(user__username=self.request.user)
              except:
                  cart = None
  
              if cart == None:
                  HttpResponseRedirect(reverse("cart"))
  
          else:
              cart_id = self.request.session.get("cart_id")
              if cart_id == None:
                  HttpResponseRedirect(reverse("cart"))
  
              cart = Cart.objects.get(id=cart_id)
  
          return cart
  
      def get_context_data(self ,*args , **kwargs):
          context = super(CheckoutView , self).get_context_data(*args , **kwargs)
          user_can_continue = False
          if not self.request.user.is_authenticated():
              context["login_form"] = AuthenticationForm()
              context["next_url"] =  self.request.build_absolute_uri()
          if self.request.user.is_authenticated():
              user_can_continue = True
  
          context["user_can_continue"] = user_can_continue
          context["form"] = self.get_form()
          return context
  
      def post(self , request , *args , **kwargs):
          form = self.get_form()
          if form.is_valid():
              email = form.cleaned_data.get("email")
              return self.form_valid(form)
          else:
              return self.form_invalid(form)
  
      def get_success_url(self):
          return reverse('checkout')
  </code></pre>
  
  <p>here is the template</p>
  
  <pre><code>&lt;form method="POST" action=""&gt;
  {% csrf_token %}
  {{form | crispy }}
  &lt;input type="submit" class="btn btn-success" value="continue"&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>here is the traceback</p>
  
  <pre><code>File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response
    132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "C:\Python27\lib\site-packages\django\views\generic\base.py" in view
    71.             return self.dispatch(request, *args, **kwargs)
  File "C:\Python27\lib\site-packages\django\views\generic\base.py" in dispatch
    89.         return handler(request, *args, **kwargs)
  File "C:\Users\lenovo\Desktop\plump\Plumpin\src\carts\views.py" in post
    151.          return self.form_invalid(form)
  File "C:\Python27\lib\site-packages\django\views\generic\edit.py" in form_invalid
    115.         return self.render_to_response(self.get_context_data(form=form))
  File "C:\Users\lenovo\Desktop\plump\Plumpin\src\carts\views.py" in get_context_data
    133.      context = super(CheckoutView , self).get_context_data(*args , **kwargs)
  File "C:\Python27\lib\site-packages\django\views\generic\detail.py" in get_context_data
    101.         if self.object:
  
  Exception Type: AttributeError at /checkout/
  Exception Value: 'CheckoutView' object has no attribute 'object'
  </code></pre>
  
  <p>how can i solve the above problem?
  here i am trying submit the form using post method but i am getting the above error</p>
  
  <p>Thank You</p>