Ticket #13714: login_required_login_url.diff
File login_required_login_url.diff, 841 bytes (added by , 14 years ago) |
---|
-
django/contrib/auth/decorators.py
30 30 return decorator 31 31 32 32 33 def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME ):33 def login_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None,): 34 34 """ 35 35 Decorator for views that checks that the user is logged in, redirecting 36 36 to the log-in page if necessary. 37 37 """ 38 38 actual_decorator = user_passes_test( 39 39 lambda u: u.is_authenticated(), 40 redirect_field_name=redirect_field_name 40 redirect_field_name=redirect_field_name, 41 login_url = login_url 41 42 ) 42 43 if function: 43 44 return actual_decorator(function)