Showing whether a user is logged in
After a user has signed up and logged in, we are still showing the Login and Sign Up buttons in the navbar (as shown in Figure 10.7):
For logged-in users, we should be hiding these buttons and showing the Logout button instead. To do so, let's go to our base template. Remember that our base template is the starting point for everything, and we extend it to the different views.
In moviereviews/templates/base.html
, add the following code in bold:
… <nav class="navbar navbar-expand-lg navbar-light bg-light mb-3"> … <div class="collapse navbar-collapse" id="navbarNavAltMarkup"> &...