add icons and chatbox
This commit is contained in:
parent
9e95fd21a7
commit
cb8eb2689c
43 changed files with 254 additions and 46 deletions
|
@ -19,17 +19,11 @@ class Message(models.Model):
|
|||
body = models.TextField(verbose_name=_('body of comment'), max_length=8192)
|
||||
|
||||
def notify_ws_clients(self):
|
||||
# inform client that there is a new message
|
||||
notification = {
|
||||
'type': 'recieve_group_message',
|
||||
'message': '{}'.format(self.id)
|
||||
}
|
||||
channel_layer = get_channel_layer()
|
||||
# print("user.id {}".format(self.user.id))
|
||||
# print("user.id {}".format(self.recipient.id))
|
||||
|
||||
async_to_sync(channel_layer.group_send)("{}".format(self.user.id), notification)
|
||||
async_to_sync(channel_layer.group_send)("{}".format(self.recipient.id), notification)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
new_message = self.id
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue