Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Django View Authorization: Restricting Access (Summary)

Most complex websites require user accounts. Once you have user accounts, you need to limit where they can and can’t go. Django provides role-based authentication to help you with these restrictions.

In this course, you learned how to:

  • Use HttpRequest and HttpRequest.user objects
  • Authenticate and authorize users
  • Differentiate between regular, staff, and admin users
  • Secure a view with the @login_required decorator
  • Restrict a view to different roles with the @user_passes_test decorator
  • Use the Django messages framework to notify your users
Download

Sample Code (.zip)

17.9 KB
Download

Course Slides (.pdf)

1.4 MB
Avatar image for SwingPy

SwingPy on Nov. 21, 2022

The course is short and to the point. I really like that it is a practical explanation of a very common problem. If more is needed, (groups, permissions, etc) there are other courses available.

Become a Member to join the conversation.