title: How to access object within class-based views mixin?
body: <p>I use class-based view to update my model:</p>
  
  <pre><code>class BlogUpdateView(UpdateView):
      model=Blog
  
      def get_context_data(self, **kwargs):
          context = super(BlogUpdateView, self).get_context_data(**kwargs)
          context['author'] = get_object_or_404(User,
              username__iexact=self.kwargs['username'])
          return context
  </code></pre>
  
  <p>I want to follow the DRY principle and avoid repeating <code>get_context_data</code> in every view function. The question is nearly the same as <a href="https://stackoverflow.com/q/10337290/1061572">this one</a>. Relying on the answer given by <a href="https://stackoverflow.com/users/43490/jj">@Jj</a> I suppose my class to look like this:</p>
  
  <pre><code>class BlogMixin(object):
      def get_author(self):
        # How to get author?
        return author
  
      def get_context_data(self, **kwargs):
        context = super(BlogMixin, self).get_context_data(**kwargs)
        context['author'] = self.get_author()
        return context
  </code></pre>
  
  <p>My question is: How can I access object in mixin class?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Answer is given in mongoose_za comment. I can get author with this line:</p>
  
  <pre><code>author = User.objects.get(username__iexact=self.kwargs['username'])
  </code></pre>