From 475b634a4b771de186cd5514cee293c9ce6955e1 Mon Sep 17 00:00:00 2001 From: baoliang Date: Sat, 5 Dec 2020 16:14:34 +0800 Subject: [PATCH] add message --- polls/views/task.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/polls/views/task.py b/polls/views/task.py index ff2f44f..5c61416 100644 --- a/polls/views/task.py +++ b/polls/views/task.py @@ -68,8 +68,10 @@ def create_task(request): users = Group_user.objects.filter(group=group) for u in users: g = Group.objects.get(id=group) - content = '%s在群组“%s”发布了任务,请查收消息' % (profile, g.name) - Notice.create_normal_notice(u.user_id, content, group) + profile = Userprofile.objects.filter(user_id=u.user_id).first() + if profile and profile.status == 1: + content = '%s在群组“%s”发布了任务,请查收消息' % (profile, g.name) + Notice.create_normal_notice(u.user_id, content, group) return JsonResponse({'status': 'success'})