'How can I include all my html files in my base.html file in django?
I have a couple of html files in my django project including a base.html file, navbar.html, footer.html, etc. I have included the navbar and footer files in the base file and extended the base file to a home.html file which happens to be my main page. I recently created a courses.html file and would like this page to also be in the main page. I understand I can include it like I did with navbar and footer, but that would mean the courses.html file will be shown everywhere the base file has been extended to, and I don't want this. How can I do this?
Solution 1:[1]
If you include courses.html only in home.html then it will be seen only in view that home.html is a template in.
Anything you include in base.html will be seen at every page which uses {% extends 'base.html' %}.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | NixonSparrow |
