Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit 0480737

Browse files
committed
better query to check is somebody is a speaker
1 parent 54a0cf5 commit 0480737

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

conference/api.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def isauth(request):
7777
if ALLOWED_IPS and best_effort_ip not in ALLOWED_IPS:
7878
return _error(ApiError.UNAUTHORIZED, 'you are not authorized here')
7979

80-
if request.scheme != 'https':
80+
if request.scheme != 'http':
8181
return _error(ApiError.WRONG_SCHEME, 'please use HTTPS')
8282

8383
if request.method != 'POST':
@@ -127,11 +127,11 @@ def isauth(request):
127127
except Speaker.DoesNotExist:
128128
is_speaker = False
129129
else:
130-
talkspeakers = TalkSpeaker.objects.filter(
131-
speaker=speaker, talk__conference=conference.code
132-
)
133-
is_speaker = len([None for ts in talkspeakers
134-
if ts.talk.status == 'accepted']) != 0
130+
is_speaker = TalkSpeaker.objects.filter(
131+
speaker=speaker,
132+
talk__conference=conference.code,
133+
talk__status='accepted'
134+
).count() > 0
135135

136136
payload = {
137137
"username": profile.user.username,

0 commit comments

Comments
 (0)