From df25dea27a8efb080dac5900423682e9b798b577 Mon Sep 17 00:00:00 2001 From: Shrikrishna Singh Date: Thu, 9 Apr 2020 05:32:48 +0530 Subject: [PATCH] Use user.is_authenticated as property --- junction/conferences/permissions.py | 2 +- junction/proposals/permissions.py | 6 +++--- junction/proposals/views.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/junction/conferences/permissions.py b/junction/conferences/permissions.py index 6e4fdc34..ab00abce 100644 --- a/junction/conferences/permissions.py +++ b/junction/conferences/permissions.py @@ -6,7 +6,7 @@ def is_reviewer(user, conference): """Returns a boolean indicating if a given user is a conference reviewer. """ - if not user.is_authenticated(): + if not user.is_authenticated: return False qs = ConferenceProposalReviewer.objects.filter( diff --git a/junction/proposals/permissions.py b/junction/proposals/permissions.py index ee316880..8d678809 100644 --- a/junction/proposals/permissions.py +++ b/junction/proposals/permissions.py @@ -13,11 +13,11 @@ def is_proposal_voting_allowed(proposal): def is_proposal_author(user, proposal): - return user.is_authenticated() and proposal.author == user + return user.is_authenticated and proposal.author == user def is_proposal_reviewer(user, conference): - authenticated = user.is_authenticated() + authenticated = user.is_authenticated is_reviewer = ConferenceProposalReviewer.objects.filter( reviewer=user.id, conference=conference, active=True ).exists() @@ -26,7 +26,7 @@ def is_proposal_reviewer(user, conference): def is_proposal_section_reviewer(user, conference, proposal): return ( - user.is_authenticated() + user.is_authenticated and ProposalSectionReviewer.objects.filter( conference_reviewer__reviewer=user, conference_reviewer__conference=conference, diff --git a/junction/proposals/views.py b/junction/proposals/views.py index b8e2fcf4..9152f610 100644 --- a/junction/proposals/views.py +++ b/junction/proposals/views.py @@ -235,7 +235,7 @@ def detail_proposal(request, conference_slug, slug, hashid=None): if public_voting_setting: public_voting_setting_value = public_voting_setting.value try: - if request.user.is_authenticated(): + if request.user.is_authenticated: proposal_vote = ProposalVote.objects.get( proposal=proposal, voter=request.user )