bootstrap Navbar active in django code example
Example: bootstrap Navbar active in django
# navbar_demo/pages/views.py...
'''We will pass a unique variable for each page whose value will be 'active' to make
a page active in navbar when it call.'''
def index(request):
context = {"home_page": "active"} # new info here
return render(request, 'pages/index.html', context)
def about(request):
context = {"about_page": "active"} # new info here
return render(request, 'pages/about.html', context)
def contact(request):
context = {"contact_page": "active"} # new info here
return render(request, 'pages/contact.html', context)
# In html file #
'''
'''