On Wed, 17 Jul 2013 11:22:36 -0700 Jon Dufresne <jon.dufre...@gmail.com> wrote: > My application requires an authenticated user for every view (with > very few exceptions). Is there a standard correct way to handle this > or should I roll my own middleware? I'm probably not the first have > this requirement.
The standard-way depende on your views: - If its function-based views, use the @login_required-decorator. - For class-based views we use the LoginRequiredMixin from django-braces. But since most of the time we have to check for permissions (and also check via our own customer-specific permissions) we only use our own PermissionRequiredMixin (derived from django-braces' mixin of the same name). If the user is not authenticated (thus AnonymousUser) it doesn't have any permissions too. Have fun, Arnold
signature.asc
Description: PGP signature