title: Get data from custom middleware in django views
body: <p>I've followed <a href="https://www.stavros.io/posts/django-page-load-time/" rel="nofollow noreferrer">this</a> link to create a custom middleware.</p>
  
  <p>The main idea is I want to show the page rendering time on my index.html page.
  My middleware object:</p>
  
  <pre><code>class StatsMiddleware(object):
  def __init__(self, get_response):
      self.get_response = get_response
  
  def __call__(self, request):
      return self.get_response(request)
  
  def process_request(self, request):
      request.start_time = time.time()
  
  def process_response(self, request, response):
      duration = time.time() - request.start_time
  
      response["render_time"] = int(duration * 1000)
      return response
  </code></pre>
  
  <p>How can I process this response object via my class-based views?</p>