Skip to content

Instantly share code, notes, and snippets.

@skyleronken
Last active August 29, 2015 13:57
Show Gist options
  • Save skyleronken/9600434 to your computer and use it in GitHub Desktop.
Save skyleronken/9600434 to your computer and use it in GitHub Desktop.
# From within resources.py
@wraps(func)
def wrapper(self, request, *args, **kwargs):
if allowed is not None:
self.method_check(request, allowed)
if login_required and not self.Meta.authentication.is_authenticated(request): # This is the only change
raise ImmediateHttpResponse(
HttpUnauthorized('Log in required for this action')
)
return func(self, request, *args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment