contact@digitalnotebooks.co
Stay Organized, Stay Inspired. Let's Write.

Login / Logout & User Restrictions Module Part 15

Back To All Notes
  • Notebook: Django: Automating Common Tasks
  • Speaker: Udemy Instructor Rathan Kumar
  • Date Created: Aug. 17, 2024, 2 a.m.
  • Owner: Rosilie

1. We completed the REGISTER module previously. To make your Login link work, we need to update our URLS.PY

2. Create our LOGIN function in the VIEWS.PY

3. Create our LOGIN.HTML

4. Update our BASE.HTML

5. Update our VIEWS.PY

Run the code:

6. We should not show REGISTER button if we are logged in, so we update our BASE.HTML AS:

7. To make our logout button work, we update our VIEWS.PY AS:

8. Test our code:

9. To make see only the tools when they log in, we must update our HOME.HTML. We add the IF ELSE statement so that the tools would only appear if we log in otherwise we see the homepage with some information instead. 

9. Load the page:

From here, you can login or register to see the Django tools.

We have made some custom CSS for our footer and home-info: We run COLLECTSTATIC to make sure that this external CSS is added to our root folder for deployment.

 



No PDF file attached.

Notebook
Notebook Details
Title: Django: Automating Common Tasks
Category: Coding