Fix error in consumer when camp matching query does not exist.

This commit is contained in:
Víðir Valberg Guðmundsson 2017-07-09 16:37:19 +02:00
parent af94eba144
commit 034543595a
1 changed files with 20 additions and 17 deletions

View File

@ -12,6 +12,7 @@ class ScheduleConsumer(JsonWebsocketConsumer):
def connect(self, message, **kwargs):
camp_slug = message.http_session['campslug']
try:
camp = Camp.objects.get(slug=camp_slug)
days = list(map(
lambda day:
@ -29,6 +30,8 @@ class ScheduleConsumer(JsonWebsocketConsumer):
"days": days,
"action": "init"
})
except Camp.DoesNotExist:
pass
def raw_receive(self, message, **kwargs):
content = self.decode_json(message['text'])