title: django middleware set user special global variable
body: <p>if every web page has a user new message notice(new message count, like message(1)), how can i pass variable '{ new_message_count: 1}' to every view 
  i want to using middleware:</p>
  
  <pre><code>class page_variable():
  def process_request(self, request):
      # put the variable to the request or response so can used in template variable
      return None
  </code></pre>
  
  <p>and template look like:</p>
  
  <pre><code>&lt;a href="/message/"&gt;new &lt;em&gt;({{ new_message_count }})&lt;/em&gt;&lt;/a&gt;
  </code></pre>