title: Django multiple template rendering
body: <p>At the moment I'm working on a pretty complex page that needs to be updated when a user selects a recipe that is displayed on the page.Upon selection of a recipe, the price and the name of the recipe need to be displayed on the page. </p>
  
  <p>My thought is to render multiple extend/include templates that are each responsible for their own part of the webpage.However, I face a few problems:</p>
  
  <ol>
  <li>I need multiple view functions to process data for all templates. </li>
  <li>I need to pass the request to multiple view functions so that they return the template with the correct data</li>
  <li>One of the functions not only takes the request but also the slug of a model object to update data on the page. </li>
  </ol>
  
  <p>Questions: </p>
  
  <ol>
  <li>How do I send responses/data from different view functions to each other?</li>
  <li>How do I pass the request to multiple functions?</li>
  <li>Does the rendering of the extends also make sure that the base.html is rendered?</li>
  <li>Are extends the right thing to use or should I use includes?</li>
  </ol>
  
  <p>So far I have thought of this system: </p>
  
  <p>base.html</p>
  
  <pre><code>&lt;body&gt;
      {% block extend1 %}
      {% endblock %}
  
      {% block extend2 %}
      {% endblock %}
  
      {% block extend3 %}
      {% endblock %}
  &lt;/body&gt;
  </code></pre>
  
  <p>extend1.html (example for the 3 extends)</p>
  
  <pre><code>{% extends base.html %}
  
  {% block extend1 %}
      #html code
  {% endblock
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def extend1(request):
      #do something
      template = 'extend1.html' 
      context = a, b, c
      return render(template.render(context))
  
  def extend2(request):
      #do something
      template = 'extend2.html' 
      context = d, e, f
      return render(template.render(context))
  
  def extend3(request, slug):
      #do something
      template = 'extend3.html' 
      context = g, h, i
      return render(template.render(context))
  </code></pre>