Issue
Is there a way I can apply the login_required
decorator to an entire app? When I say "app" I mean it in the django sense, which is to say a set of urls and views, not an entire project.
Solution
Yes, you should use middleware.
Try to look through solutions which have some differences:
- http://www.djangosnippets.org/snippets/1179/ - with list of exceptions.
- http://www.djangosnippets.org/snippets/1158/ - with list of exceptions.
- http://www.djangosnippets.org/snippets/966/ - conversely with list of login required urls.
- http://www.djangosnippets.org/snippets/136/ - simplest.
Answered By - Leonid Shvechikov
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.