From b244443dc1b45cd41b4ce52c1d957e57bdd8a0e2 Mon Sep 17 00:00:00 2001 From: baoliang Date: Sat, 5 Dec 2020 14:51:51 +0800 Subject: [PATCH] add message --- polls/views/task.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/polls/views/task.py b/polls/views/task.py index 2368702..ff2f44f 100644 --- a/polls/views/task.py +++ b/polls/views/task.py @@ -109,3 +109,11 @@ def get_task(request): result['added'] = task.added.strftime("%Y-%m-%d %H:%M:%S") return JsonResponse({'status': 'success', 'message': result}) +@csrf_exempt +def create_test_task(request): + # if request.method == 'GET': + # return HttpResponse(status=405) + # channel_layer = get_channel_layer() + # async_to_sync(channel_layer.group_send)( + # "testroom", {"type": "chat.message", "message": "helo"}) + return JsonResponse({'status': 'success'})