Skip to content

Instantly share code, notes, and snippets.

View andrecarini's full-sized avatar

André Carini andrecarini

View GitHub Profile
@m4rc1e
m4rc1e / django-anonymous-required.py
Created June 27, 2016 08:56
Django decorator for views that allow only unauthenticated users to access view.
from django.shortcuts import redirect
def anonymous_required(redirect_url):
"""
Decorator for views that allow only unauthenticated users to access view.
Usage:
@anonymous_required(redirect_url='company_info')