{endblock content %this template extends base html to ensure that the login page will have the same look and feel as the rest of the site note that template in one app can extend template from another app if the form' errors attribute is setwe display an error message ureporting that the username and password combination don' match anything stored in the database we want the login view to process the formso we set the action argument as the url of the login page the login view sends form to the templateand it' up to us to display the form and add submit button at we include hidden form element'next'the value argument tells django where to redirect the user after they've logged in successfully in this casewe send the user back to the home page linking to the login page let' add the login link to base html so it appears on every page we don' want the link to display when the user is already logged inso we nest it inside an {if %tagbase html learning log topics {if user is_authenticated % hello{user username }{else % log in {endif %{block content %}{endblock content %in django' authentication systemevery template has user variable availablewhich always has an is_authenticated attribute setthe attribute is true if the user is logged in and false if they aren' this allows you to display one message to authenticated users and another to unauthenticated users here we display greeting to users currently logged in authenticated users have an additional username attribute setwhich we use to personalize the greeting and remind the user they're logged in at we display link to the login page for users who haven' been authenticated using the login page we've already set up user accountso let' log in to see if the page works go to for logout link in the header and click it user accounts