Ticket #2629: auth-decorator-permission-required.diff

File auth-decorator-permission-required.diff, 603 bytes (added by dummy@…, 18 years ago)
  • django/contrib/auth/decorators.py

     
    2628    to the log-in page if necessary.
    2729    """
    2830    )
     31
     32def permission_required(perm, login_url=LOGIN_URL):
     33    return user_passes_test(lambda u: u.has_perm(perm), login_url=login_url)
     34permission_required.__doc__ = (
     35    """
     36    Decorator for views that checks if a user has explicit permission,
     37    redirectiing to the log-in page if necessary.
     38    """
     39    )
Back to Top