title: Django UpdateView with ImageField attribute
body: <p>I am having trouble in making UpdateView Class.I was able to do createView and UpdateView without adding any form before adding up the imageField. But now I have imageField, which is creating problem. Fortunately,  I am able to do createView and its working fine.</p>
  
  <p>Following is my code for CreateView</p>
  
  <pre><code>class CreatePostView(FormView):
      form_class = PostForm
      template_name = 'edit_post.html'
  
      def get_success_url(self):
          return reverse('post-list')
      def form_valid(self, form):
          form.save(commit=True)
          # messages.success(self.request, 'File uploaded!')
          return super(CreatePostView, self).form_valid(form)
      def get_context_data(self, **kwargs):
          context = super(CreatePostView, self).get_context_data(**kwargs)
          context['action'] = reverse('post-new')
          return context
  </code></pre>
  
  <p>However, I tried to do UpdateView(ViewForm). Following is my code : </p>
  
  <pre><code>class UpdatePostView(SingleObjectMixin,FormView):
  model = Post
  form_class = PostForm
  tempate_name = 'edit_post.html'
  
  # fields = ['title', 'description','content','published','upvote','downvote','image','thumbImage']
  
  def get_success_url(self):
      return reverse('post-list')
  def form_valid(self, form):
      form.save(commit=True)
      # messages.success(self.request, 'File uploaded!')
      return super(UpdatePostView, self).form_valid(form)
  
  def get_context_data(self, **kwargs):
      context = super(UpdatePostView, self).get_context_data(**kwargs)
      context['action'] = reverse('post-edit',
                                  kwargs={'pk': self.get_object().id})
      return context
  </code></pre>
  
  <p>When I try to run the updateView, its giving me following error:</p>
  
  <blockquote>
    <p>AttributeError at /posts/edit/23/</p>
    
    <p>'UpdatePostView' object has no attribute 'get_object'</p>
    
    <p>Request Method:   GET Request URL:
      <a href="http://localhost:8000/posts/edit/23/" rel="nofollow">http://localhost:8000/posts/edit/23/</a> Django Version:    1.8.2 Exception
    Type:     AttributeError Exception Value:     </p>
    
    <p>'UpdatePostView' object has no attribute 'get_object'</p>
    
    <p>Exception Location:   /home/PostFunctions/mysite/post/views.py in
    get_context_data, line 72 Python Executable:  /usr/bin/python Python
    Version:  2.7.6</p>
  </blockquote>
  
  <p>Following is my url.py : </p>
  
  <pre><code>#ex : /posts/edit/3/
  
  url(r'^edit/(?P&lt;pk&gt;\d+)/$', post.views.UpdatePostView.as_view(),
      name='post-edit',),
  </code></pre>