title: How to insert multiple Django blocks into one template?
body: <p>I am trying to use more different views in one template via different blocks or include method but I have got stuck. My aim is to implement my different views into one template. I tried to more solution but these haven't worked for me. I show these solution:</p>
  
  <p><strong>My views:</strong></p>
  
  <pre><code>def  dashboard_data(request):
      # Here I collect data from my PostgreSQL database I push these into 
      #Objects and I send it to my test_a.html via render like below.
  
      return render(request, 'my_project/test_a.html', send_data)
  
  def chart_data(request):
      #In these view my final goal is to collect data from database and create 
      #charts but for the simplicity I just use a list (a=[1,2,3,4]) and I 
      #push it to the test_b.html and I render it.
  
  
      render(request, 'my_project/test_b.html', send_data))
  </code></pre>
  
  <p><strong>My templates:</strong></p>
  
  <p>1, base.html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  
    {% block title %}&lt;title&gt;My project&lt;/title&gt;{% endblock %}
    &lt;meta charset="utf-8"&gt;
    &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
    &lt;!-- Include CSS files --&gt;
    {% load static %}
    &lt;!-- Include CSS files --&gt;
    &lt;link rel="stylesheet" href="{% static 'css/bootstrap.css' %}"&gt;
    &lt;link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}"&gt;
    &lt;link rel="stylesheet" href="{% static 'css/bootstrap-table.css' %}"&gt;
    &lt;link rel="stylesheet" href="{% static 'css/styles.css' %}"&gt;
    &lt;link rel="stylesheet" href="{% static 'css/font-awesome.min.css' %}"&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
       {% block sidebar %}
  
       {% endblock %}
  
       {% block content%}
       {% endblock %}
  
  &lt;/body&gt;
  &lt;/html&gt; 
  </code></pre>
  
  <p>1, test_a.html</p>
  
  <pre><code>  {% extends "monitor/base.html" %}
  
    {%block content%}
  
    {%for i in table%}
         &lt;p&gt; {{i.record}}&lt;/p&gt;
    {%endfor%} 
  
    {%endblock}
  </code></pre>
  
  <p>2, test b.html</p>
  
  <pre><code>  {%for i in a%}
         &lt;p&gt; {{i}}&lt;/p&gt;
    {%endfor}
  </code></pre>
  
  <p>So my goal would be that the test_b.html's result could appear in the base.html.</p>
  
  <p><strong>My solutions:</strong></p>
  
  <p><strong>A</strong>: I tried to put into a block the test_b.html and integrate in the base.html</p>
  
  <p><em>1, base.html (test1):</em></p>
  
  <pre><code> {% block conent%}
  
   {% endblock %}
  
   {% block chart%}
  
   {% endblock %}
  </code></pre>
  
  <p><em>1, test_b.html (test1)</em>:</p>
  
  <pre><code>{% extends "monitor/base.html" %}
  
  {%block chart%}    
  
  {%for i in a%}
         &lt;p&gt; {{i}}&lt;/p&gt;
  {%endfor}
  
  {%endblock%}
  </code></pre>
  
  <p><strong>B</strong>: I tried to use  <code>{{ block.super }}</code></p>
  
  <p><em>1, base.html (test1):</em></p>
  
  <pre><code> {% block conent%}
  
   {% endblock %}
  </code></pre>
  
  <p><em>1, test_b.html (test1)</em>:</p>
  
  <pre><code>{% extends "monitor/base.html" %}
  
  {%block content%}    
   {{ block.super }} 
  {%for i in a%}
         &lt;p&gt; {{i}}&lt;/p&gt;
  {%endfor}
  
  {%endblock%}
  </code></pre>
  
  <p><strong>C:</strong> Finally I used include method too but I didn't work for me as well. Here I tried to use simple html tags like (<code>&lt;p&gt;Hello world&lt;/p&gt;</code>) int the test_b.html and worked. So If I do not use variables it works but I have to use my variables from my views.</p>
  
  <p><em>1, test_a.html</em></p>
  
  <pre><code>{% extends "monitor/base.html" %}
  
  {%block chart%}    
  
  {%for i in a%}
        &lt;p&gt; {{i}}&lt;/p&gt;
  {%endfor}
  
  {%endblock%}
  {% include "my_project/test_b.html" %} 
  </code></pre>
  
  <p><em>2, test_b.html</em></p>
  
  <pre><code>{%for i in a%}
       &lt;p&gt; {{i}}&lt;/p&gt;
  {% endfor %}
  </code></pre>