[Fixed]-Creating template from different block in django?

1👍

You could separate the content.

I guess you have something like this:

<!-- graph.html -->
{% extends "base.html" %}
{% block 'mainContent'%}
    {# Your graphs html here #}
{% endblock %}

But you could put the graph html in a separate, let’s say graph_template.html template and include it:

<!-- graph.html -->
{% extends "base.html" %}
{% block 'mainContent'%}
    {% include 'graph_template.html' %}
{% endblock %}

And then in summary.html you can include graph_template.html.

👤Gocht

Leave a comment