title: django how to create TemplateView instance with code
body: <p>I have a function view,and i want to create a TemplateView instance in this function,such as</p>
  
  <pre><code>def MyView(request):
      #view =TemplateView(request)
      #view =TemplateView.as_view()
      #view =TemplateView.as_view()(request)
      return view
  </code></pre>
  
  <p>but,all of them is wrong. How do I create the view?</p>
  
  <p>urls:</p>
  
  <pre><code>mysite/widget1/
  mysite/widget2/
  mysite/widget3/
  </code></pre>
  
  <p>views:</p>
  
  <pre><code>class BaseWidgetTemplateView(TemplateView):
      pass
  class Widget1View(BaseWidgetTemplateView):
      pass
  class Widget2View(BaseWidgetTemplateView):
      pass
  class Widget3View(BaseWidgetTemplateView):
      pass
  </code></pre>
  
  <p>the request to pass to the function view and pass to the TemplateView is diffent object type
  the request which pass to the function is</p>
  
  <pre><code>module 'django.http.request
  </code></pre>
  
  <p>and the request in TemplateView is</p>
  
  <pre><code>WSGIRequest
  </code></pre>