title: Subclassing Django class based views?
body: <p>I'm trying to warp my head around Django's new class-based views from 1.3.</p>
  
  <p>I've done a bit of reading:</p>
  
  <ul>
  <li><a href="http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html" rel="nofollow">http://reinout.vanrees.org/weblog/2011/08/24/class-based-views-usage.html</a></li>
  <li><a href="http://www.caktusgroup.com/blog/2011/12/29/class-based-views-django-13/" rel="nofollow">http://www.caktusgroup.com/blog/2011/12/29/class-based-views-django-13/</a></li>
  </ul>
  
  <p>But the one thing I haven't seen an example of, or how to do is, can several views subclass a common 'parent' class, reusing the data from there? (Pardon my thrashing of the common nomenclature)</p>
  
  <p>An example of what I am trying to do:</p>
  
  <pre><code>class MyParentClass(TemplateView):
     def get(self, request, *args, **kwargs):
       session_data = request.session
       other_variables = foovars
       return self.render_to_response(context)
  
  class MyChildClassOne(TemplateView):
      template_name = "template_one.htm"
  
      def get(self,request, *args, **kwargs):
        resultant_data = foodata
        return {'data' : resultant_data }
  
  
  class MyChildClassTwo(TemplateView):
      template_name = "template_two.htm"
  
      def get(self,request, *args, **kwargs):
        other_data = foootherdata
        return {'data' : other_data }
  </code></pre>
  
  <p>So that the only difference between the two child classes is the templates they use and the 'data' they return. Both views would also return session_data and other_variables from the parent class, and therefore not repeating "return session_data, other_variables" in every  child class.</p>