You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
491 B
Python
14 lines
491 B
Python
from osinacore.api.utils import *
|
|
from osichat.models import *
|
|
from rest_framework.decorators import api_view
|
|
from .serializers import *
|
|
from django.shortcuts import get_object_or_404
|
|
|
|
@api_view(['GET'])
|
|
def get_chat_rooms(request):
|
|
chat_rooms = ChatRoom.objects.annotate(last_update=Max('chatmessage__date_sent')).order_by('-last_update', '-date_created')
|
|
chat_rooms_serializer = ChatRoomSerializer(chat_rooms, many=True)
|
|
return successRes(chat_rooms_serializer.data)
|
|
|
|
|