title: Using Django templates as snippets
body: <p>Is it possible to create a django template that can be used (nested) inside of another django template?  I know of the <code>extends</code> command, but I don't think that is what I'm looking for.  Maybe I just don't know how to make it work for this situation.  Let me give an example.</p>
  
  <p>It is common in most webapps to display the user's login status, I'm looking for a way to put the logic for this (with the corresponding "Welcome Mr. Foo" and "Need to sign up?") into a small template, like this:</p>
  
  <p>loginstatus.html</p>
  
  <pre><code>{% if LoggedIn %}
      Message message link link
  {% else %}
      Other message different link
  {% endif %}
  </code></pre>
  
  <p>Now, I figure I'll have to call the rendering engine and store this output into a variable, then pass that to the base template when I render it, so that my base template looks like this:</p>
  
  <p>index.html</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="Header"&gt;{{ LoginStatus }}&lt;/div&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Now, I know this is a pretty lame example, it only saved me 5 lines, but I envision doing this for creating a Navigation bar based on the user's role, displaying a news feed with regard to the users position or selected interest, etc.</p>
  
  <p>So, in short, is it possible (because I haven't been able to make it work how I envision it) to pre-render a django template and then include that rendered html into another django template?</p>
  
  <p>I don't think it matters, but I am working with Google App Engine also, if that changes anything.</p>