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:
Tim Abbott 2020-01-27 17:48:53 -08:00
parent 1655aabe65
commit a3f08f01ec
2 changed files with 2 additions and 2 deletions

View File

@ -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"

View File

@ -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})