Fix error in consumer when camp matching query does not exist.
This commit is contained in:
parent
af94eba144
commit
034543595a
|
@ -12,6 +12,7 @@ class ScheduleConsumer(JsonWebsocketConsumer):
|
||||||
|
|
||||||
def connect(self, message, **kwargs):
|
def connect(self, message, **kwargs):
|
||||||
camp_slug = message.http_session['campslug']
|
camp_slug = message.http_session['campslug']
|
||||||
|
try:
|
||||||
camp = Camp.objects.get(slug=camp_slug)
|
camp = Camp.objects.get(slug=camp_slug)
|
||||||
days = list(map(
|
days = list(map(
|
||||||
lambda day:
|
lambda day:
|
||||||
|
@ -29,6 +30,8 @@ class ScheduleConsumer(JsonWebsocketConsumer):
|
||||||
"days": days,
|
"days": days,
|
||||||
"action": "init"
|
"action": "init"
|
||||||
})
|
})
|
||||||
|
except Camp.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
def raw_receive(self, message, **kwargs):
|
def raw_receive(self, message, **kwargs):
|
||||||
content = self.decode_json(message['text'])
|
content = self.decode_json(message['text'])
|
||||||
|
|
Loading…
Reference in a new issue