1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-24 09:48:48 +02:00

Setup chat UI

Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
Emmy D'Anello
2024-04-27 12:08:10 +02:00
parent 4026fe53c3
commit c20554e01a
5 changed files with 161 additions and 45 deletions

View File

@ -4,6 +4,8 @@
from django.contrib.auth.mixins import LoginRequiredMixin
from django.views.generic import TemplateView
from chat.models import Channel
class ChatView(LoginRequiredMixin, TemplateView):
"""
@ -11,3 +13,9 @@ class ChatView(LoginRequiredMixin, TemplateView):
with Javascript and websockets.
"""
template_name = "chat/chat.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
from asgiref.sync import async_to_sync
context['channels'] = async_to_sync(Channel.get_accessible_channels)(self.request.user, 'read')
return context