python - Creating template from different block in django? -
i trying create single page different content different template in django can print it. kind of summary of different page
- base.html - maincontent block rendered inside template
- main.html - need maincontent block here
- graph.html - need maincontent block here
- charts.html - need maincontent block here
- summary.html - need content main, graph, charts here (require)
i have base template extended on every page (it has navbar, footer , sidebar)
{% extends "base.html" %} there block inside base template graph, main, chart content displayed. trying accomplish maincontent page , add new template called summary.html
since every page extending base not sure how that? tried using include include base every page.
edit: know can separate maincontent own separate files have lot of templates , looking other solutions.
you separate content.
i guess have this:
<!-- graph.html --> {% extends "base.html" %} {% block 'maincontent'%} {# graphs html here #} {% endblock %} but put graph html in separate, let's graph_template.html template , include it:
<!-- graph.html --> {% extends "base.html" %} {% block 'maincontent'%} {% include 'graph_template.html' %} {% endblock %} and in summary.html can include graph_template.html.
Comments
Post a Comment