NDOJ/chat_box/views.py

18 lines
446 B
Python
Raw Normal View History

2020-01-27 20:37:52 +00:00
from django.utils.translation import gettext as _
2020-03-16 02:23:14 +00:00
from django.views.generic import ListView
2020-01-27 20:37:52 +00:00
2020-03-16 02:23:14 +00:00
from .models import Message
2020-01-27 20:37:52 +00:00
2020-03-16 02:23:14 +00:00
class ChatView(ListView):
model = Message
2020-03-19 22:51:56 +00:00
context_object_name = 'message'
2020-03-16 02:23:14 +00:00
template_name = 'chat/chat.html'
2020-03-19 05:13:55 +00:00
title = _('Chat Box')
2020-03-19 22:51:56 +00:00
paginate_by = 10
2020-03-19 05:13:55 +00:00
def get_context_data(self, **kwargs):
2020-03-19 22:51:56 +00:00
context = super().get_context_data(**kwargs)
2020-03-19 05:13:55 +00:00
context['title'] = self.title
return context