Home » Python » python – Django multiple templates-Exceptionshub

python – Django multiple templates-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment


I’m building a site where users can view their posts Like this. After building the quizzes portion, I tabbed to “blogs” where I realized I needed to import the blogs template to use it.

I’m using the quiz template already like this
{% extends '../main/base.html' %} {% block title %}View Quizzes{% endblock %} {% block content %}

but I need to access the blog template as well. How can I do this? Thanks!

How to&Answers:

You can include the blog template into the main one like:

{% include "path/to/blogs.html" %}    

It’s best to have a main template which includes blogs, quizzes… (instead of inheritance)


You don’t need django to do this.