Login Required Middleware with Next Parameter
Based on [onecreativenerd](http://djangosnippets.org/users/onecreativenerd/) code. Sometimes it's a real pain to use the @login_required decorator all over the views of a complicated site. This middleware requires login on every page by default and supports a list of regular expression to figure out the exceptions. This way you don't have to worry about forgetting to decorate a view. This snippet requires LOGIN_URL to be set in settings.py, and optionally allows you fill out LOGIN_EXEMPT_URLS, a tuple of regular expressions (similar to urls.py) that lists your exceptions. Example: LOGIN_EXEMPT_URLS = ( r'^about\.html$', r'^legal/', # allow the entire /legal/* subsection )
- middleware
- django
- login
- login_required
- next