Chapter 8: Advanced Views and URLconfs - 0 views
-
Here, each view starts by checking that request.user is authenticated — that is, the current user has successfully logged into the site — and redirects to /accounts/login/ if not.
-
It would be nice if we could remove that bit of repetitive code from each of these views and just mark them as requiring authentication.
-
Now, we can remove the if not request.user.is_authenticated() checks from our views and simply wrap them with requires_login in our URLconf:
- ...3 more annotations...