This commit is contained in:
Víðir Valberg Guðmundsson 2018-04-15 19:44:14 +02:00
parent 969e737d3e
commit 5e6ff4e76f

View file

@ -83,13 +83,19 @@ class ScheduleConsumer(JsonWebsocketConsumer):
) )
if action == 'unfavorite': if action == 'unfavorite':
try:
event_instance_id = content.get('event_instance_id') event_instance_id = content.get('event_instance_id')
event_instance = EventInstance.objects.get(id=event_instance_id) event_instance = EventInstance.objects.get(
id=event_instance_id
)
favorite = Favorite.objects.get( favorite = Favorite.objects.get(
event_instance=event_instance, event_instance=event_instance,
user=user user=user
) )
favorite.delete() favorite.delete()
except EventInstance.DoesNotExist:
# We don't want to do anything.
return
if data: if data:
self.send_json(data) self.send_json(data)