Django 1.11: is_authenticated is now a property.

This commit is contained in:
Umair Khan 2017-05-18 14:42:19 +05:00 committed by Tim Abbott
parent c25e9ad193
commit 1e9c87855c
3 changed files with 4 additions and 4 deletions

View File

@ -337,7 +337,7 @@ def user_passes_test(test_func, login_url=None, redirect_field_name=REDIRECT_FIE
def logged_in_and_active(request):
# type: (HttpRequest) -> bool
if not request.user.is_authenticated():
if not request.user.is_authenticated:
return False
if not request.user.is_active:
return False
@ -503,7 +503,7 @@ def process_as_post(view_func):
def authenticate_log_and_execute_json(request, view_func, *args, **kwargs):
# type: (HttpRequest, Callable[..., HttpResponse], *Any, **Any) -> HttpResponse
if not request.user.is_authenticated():
if not request.user.is_authenticated:
return json_error(_("Not logged in"), status=401)
user_profile = request.user
if not user_profile.is_active:

View File

@ -89,7 +89,7 @@ def rest_dispatch(request, **kwargs):
# This request API based authentication.
target_function = authenticated_rest_api_view()(target_function)
# /json views (web client) validate with a session token (cookie)
elif not request.path.startswith("/api") and request.user.is_authenticated():
elif not request.path.startswith("/api") and request.user.is_authenticated:
# Authenticated via sessions framework, only CSRF check needed
target_function = csrf_protect(authenticated_json_view(target_function))

View File

@ -424,7 +424,7 @@ def get_dev_users(extra_users_count=10):
def login_page(request, **kwargs):
# type: (HttpRequest, **Any) -> HttpResponse
if request.user.is_authenticated():
if request.user.is_authenticated:
return HttpResponseRedirect("/")
if is_subdomain_root_or_alias(request) and settings.REALMS_HAVE_SUBDOMAINS:
redirect_url = reverse('zerver.views.registration.find_my_team')