title: Django UpdateView, get the current object being edit id?
body: <p>I am trying to get the current record being edited's id, but am failing thus far. my view is as per the below:</p>
  
  <p>views.py</p>
  
  <pre><code>class EditSite(UpdateView):
      model = SiteData
      form_class = SiteForm
      template_name = "sites/site_form.html"
  
      @method_decorator(user_passes_test(lambda u: u.has_perm('config.edit_subnet')))
      def dispatch(self, *args, **kwargs):
          self.site_id = self.object.pk
          return super(EditSite, self).dispatch(*args, **kwargs)
  
      def get_success_url(self, **kwargs):         
              return reverse_lazy("sites:site_overview", args=(self.site_id,))
  
      def get_form_kwargs(self, *args, **kwargs):
          kwargs = super().get_form_kwargs()
          return kwargs
  
      def get_context_data(self, **kwargs):
          context = super().get_context_data(**kwargs)
          context['SiteID']=self.site_id
          context['SiteName']=self.location
          context['FormType']='Edit'
  
          return context
  </code></pre>
  
  <p>and the error:</p>
  
  <pre><code>File "/itapp/itapp/sites/views.py" in dispatch
    890.         self.site_id = self.object.pk
  
  Exception Type: AttributeError at /sites/site/edit/7
  Exception Value: 'EditSite' object has no attribute 'object'
  </code></pre>
  
  <p>ive tried:</p>
  
  <pre><code>self.object.pk
  object.pk
  self.pk
  </code></pre>