i have a view that shows my navigation bar, i am adding the navgigation bar dynamically from the database, but th problem is that i have to add that same piece of code to all my views for the navigation text to show up and that is making my code so length, is there a way to automatically extends the peice of code that is getting my navigation to all the views, so when i go to another page like the about page or contact, or profile page i can still see the navigation bar. Now only when i see the navigation bar is when i go to the index.html
views.py
def index(request):
designcatlist = DesignCategory.objects.all()
prglangcatlist = ProgrammingLanguagesCategory.objects.all()
howtocatlist = HowToCategory.objects.all()
context = { ... }
def about_page(request):
designcatlist = DesignCategory.objects.all()
prglangcatlist = ProgrammingLanguagesCategory.objects.all()
howtocatlist = HowToCategory.objects.all()
context = { ... }
def contact_page(request):
designcatlist = DesignCategory.objects.all()
prglangcatlist = ProgrammingLanguagesCategory.objects.all()
howtocatlist = HowToCategory.objects.all()
context = { ... }
def profile_page(request):
designcatlist = DesignCategory.objects.all()
prglangcatlist = ProgrammingLanguagesCategory.objects.all()
howtocatlist = HowToCategory.objects.all()
context = { ... }
NOTE as you can see in the code above, i need to add the same piece of code for the naviation to show up on those pages.