Skip to content

Instantly share code, notes, and snippets.

@erickgnavar
Created December 14, 2012 04:58
Show Gist options
  • Save erickgnavar/4282785 to your computer and use it in GitHub Desktop.
Save erickgnavar/4282785 to your computer and use it in GitHub Desktop.
Django LoginRequiredMixin
from django.contrib.auth.decorators import login_required
from django.utils.decorators import method_decorator
class LoginRequiredMixin(object):
@method_decorator(login_required)
def dispatch(self, *args, **kwargs):
return super(LoginRequiredMixin, self).dispatch(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment