emile 10 months ago
parent 38d673b89b
commit d7904bb095

@ -107,7 +107,7 @@ class TicketRoomConsumer(WebsocketConsumer):
def update_handler(self, event): def update_handler(self, event):
update_id = event['update_id'] update_id = event['update_id']
update = TicketUpdate.objects.get(id=update_id) update = TicketUpdate.objects.get(id=update_id) #No need for serialize because in the context of the method not in the event data
context = { context = {
'update': update, 'update': update,
'user': self.user 'user': self.user
@ -185,8 +185,8 @@ class TicketRoomConsumer(WebsocketConsumer):
'last_name': conn.user.last_name, 'last_name': conn.user.last_name,
'image': conn.user.staffprofile.image.url if hasattr(conn.user, 'staffprofile') and conn.user.staffprofile.image else None, 'image': conn.user.staffprofile.image.url if hasattr(conn.user, 'staffprofile') and conn.user.staffprofile.image else None,
'date': conn.date.isoformat() if conn.date else None, 'date': conn.date.isoformat() if conn.date else None,
} for conn in connections } for conn in connections
] ] #Everything included in a webscoket's event data needs to be serialized
} }
async_to_sync(self.channel_layer.group_send)( async_to_sync(self.channel_layer.group_send)(
self.ticket_number, event self.ticket_number, event

Loading…
Cancel
Save