diff --git a/polls/views/__pycache__/message.cpython-38.pyc b/polls/views/__pycache__/message.cpython-38.pyc index 7f58771..b21ef7c 100644 Binary files a/polls/views/__pycache__/message.cpython-38.pyc and b/polls/views/__pycache__/message.cpython-38.pyc differ diff --git a/polls/views/message.py b/polls/views/message.py index 0e86951..28dd93d 100644 --- a/polls/views/message.py +++ b/polls/views/message.py @@ -16,15 +16,9 @@ def last_messages(request): return HttpResponse(status=405) id = request.user.id group_id = request.GET.get('group_id') - messages = Message.objects.filter(send_to_id=group_id)[:100] + messages = reversed(Message.objects.filter(send_to_id=group_id).order_by('-added')[:100]) results = [] - filter_dict = dict() - for m in messages: - if m.type == 4 or m.type == 1: - task_id = m.task_id - if task_id: - if task_id in filter_dict: - c = filter_dict[task_id] + for o in messages: result = dict() t = o.type