django how to set a navbar active


Here is what the above code is Doing:
1. We’re adding a new item to the navbar.
2. We’re using the {% url %} template tag to generate the URL for the view.
3. We’re using the {% if %} template tag to check if the current view is the one we’re linking to.
4. If it is, we’re adding the active class to the navbar item.

The {% url %} template tag takes the name of a view and generates the URL for that view.

The {% if %} template tag checks if a condition is True. If it is, it renders the code between {% if %} and {% endif %}.

The active class is a Bootstrap class that highlights the active item in the navbar.

Save your changes and refresh the page. You should see the new item in the navbar.

Click on the new item. You should see the list of scores.

Click on the Home link in the navbar. You should see the home page.

Click on the Scores link in the navbar. You should see the list of scores.

Click on the Add Score link in the navbar. You should see the add score form.

Click on the Home link in the navbar. You should see the home page.

Click on the Scores link in the navbar. You should see the list of scores.

Click on the Add Score link in the navbar. You should see the add score form.

Click on the Home link in the navbar. You should see the home page.

Click on the Scores link in the navbar. You should see the list of scores.

Click on the Add Score link in the navbar. You should see the add score form.

Click on the Home link in the navbar. You should see the home page.

Click on the Scores link in the navbar. You should see the list of scores.

Click on the Add Score link in the navbar. You should see the add score form.

Click on the Home link in the navbar. You should see the home page.

Click on the Scores link in the navbar. You should see the list of scores.

Click on the Add Score link in the navbar. You should see the add score form.