Search code examples
djangodjango-viewsdjango-templatessingle-page-applicationdjango-apps

Single page application using django-Nav Bar for django app


In Angular,we can use routing to create SPAs . So I can have a navigation bar that's common for all templates(or written only once). Basically only required part of the page loads everytime . But in django,so far I haven't seen anything like it. Do i have to include the code for the Nav bar in each template file?


Solution

  • You just have to write single time in any html file you can name whatever you want for example _base.html is the file which contains navbar code then i want to insert in every other html file then i just have to enter tag {% extends '_base.html' %} at the top of the other files and that will load the _base.html there as well. If you need more relevant code you can consult that repository as well https://github.com/wsvincent/djangox