mirror of https://github.com/zulip/zulip.git
django: Use request.user.is_authenticated consistently.
In Django 2.0, request.user.is_authenticated stops supporting `.is_authenticated()` and becomes just a property. In 1.11, it's a CallableProperty (i.e. can be used either way), and we already use it as a property in several other places, so we should just switch to using it consistently now to get it off of our Django 2.x migration checklist.
This commit is contained in:
parent
1655aabe65
commit
a3f08f01ec
|
@ -88,7 +88,7 @@ def zulip_default_context(request: HttpRequest) -> Dict[str, Any]:
|
|||
|
||||
user_is_authenticated = False
|
||||
if hasattr(request, 'user') and hasattr(request.user, 'is_authenticated'):
|
||||
user_is_authenticated = request.user.is_authenticated.value
|
||||
user_is_authenticated = request.user.is_authenticated
|
||||
|
||||
if settings.DEVELOPMENT:
|
||||
secrets_path = "zproject/dev-secrets.conf"
|
||||
|
|
|
@ -311,6 +311,6 @@ def plans_view(request: HttpRequest) -> HttpResponse:
|
|||
realm_plan_type = realm.plan_type
|
||||
if realm.plan_type == Realm.SELF_HOSTED and settings.PRODUCTION:
|
||||
return HttpResponseRedirect('https://zulipchat.com/plans')
|
||||
if not request.user.is_authenticated():
|
||||
if not request.user.is_authenticated:
|
||||
return redirect_to_login(next="plans")
|
||||
return render(request, "zerver/plans.html", context={"realm_plan_type": realm_plan_type})
|
||||
|
|
Loading…
Reference in New Issue