title: Passing template variable to parent in Django
body: <p>I have a number of apps that each have their own intro section. This intro section has quite a few lines of HTML and only a few lines are adjusted for each app (Think title and intro). I would like this intro section to live at the project level (where the navbar template lives), but I can't find a way to pass template variables from the app to the project. </p>
  
  <p>All of my apps(about 15) follow this template scheme:</p>
  
  <pre><code>app_base.html extends project base.html
  app_base.html has an {% include %} to pull in app_intro.html
  all &lt;app_unique_templates&gt;.html that are called by &lt;app&gt;/views.py, extend the app_base.html
  </code></pre>
  
  <p>To reiterate, how can I pass a template variable from /views.py to project base.html template using my app template scheme? If I can't use this scheme, can I adjust it in a way that will allow me to accomplish this?</p>
  
  <p>Thank you all in advance!</p>
  
  <p>views.py:</p>
  
  <pre><code>def add_app_context(view_context):
      app_context = {
          'app_name': 'Material Database',
          'app_desc': 'Long String goes Here For Application Description',
          'doc_link': '#',
      }
      view_context.update(app_context)
      return view_context
  
  
  class MaterialList(ListView):
      model = Material
      context_object_name = 'materials'
  
      def get_context_data(self):
          context = super().get_context_data()
          context['pagetitle'] = 'Material List'
          context['intro_btn_link'] = '/materials/new'
          context['intro_btn_name'] = 'Create New Material'
  
          return add_app_context(context)
  </code></pre>
  
  <p>app_base.html:</p>
  
  <pre><code>{% extends "mjd_tools/base.html" %}
  {% load staticfiles %}
  {% block body %}
  &lt;link rel="stylesheet" href="{% static 'mat_db/css/style.css' %}"&gt;
  
  {% include "mat_db/app_intro.html" %}
  
  {% block list %}{% endblock list %}
  
  {% block form %}{% endblock form %}
  
  &lt;script src="{% static 'mat_db/js/scripts.js' %}"&gt;&lt;/script&gt;
  {% endblock body %}
  </code></pre>
  
  <p>app_intro.html(this is what I have to repeat for each app).</p>
  
  <pre><code>&lt;div class="row"&gt;
      &lt;div class="col-sm-8"&gt;
          &lt;h1&gt;{{ app_name }}&lt;/h1&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;hr&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-sm-8"&gt;
          &lt;p&gt;
              {{ app_desc }}
          &lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="col-auto ml-auto"&gt;
          &lt;a class="btn btn-warning" role="button" href="{{ doc_link }}"&gt;Documentation&lt;/a&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;hr&gt;
  &lt;div class="row"&gt;
      &lt;div class="col-sm text-center"&gt;
          &lt;h4&gt;
              &lt;span&gt;{{ pagetitle }}&lt;/span&gt;
              {% if intro_btn_name %}
              &lt;a class="btn btn-primary btn-sm pull-right" role="button"
                  href="{{ intro_btn_link }}"&gt;{{ intro_btn_name }}&lt;/a&gt;
          &lt;/h4&gt;
          {% endif %}
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;hr&gt;
  </code></pre>