add message

This commit is contained in:
baoliang 2021-03-12 14:00:01 +08:00
parent 8c642afa2c
commit 27d5548f6f
3 changed files with 4 additions and 1 deletions

View File

@ -40,13 +40,16 @@ def create_task(request):
user = request.user user = request.user
creater_profile = user.userprofile_set.first() creater_profile = user.userprofile_set.first()
content = request.POST.get('content') content = request.POST.get('content')
url = request.POST.get('url')
if not content: if not content:
return JsonResponse({'status': 'error', 'message': '内容不能为空'}) return JsonResponse({'status': 'error', 'message': '内容不能为空'})
if not content:
return JsonResponse({'status': 'error', 'message': 'URL地址不能为空'})
groups = request.POST.getlist('groups', []) groups = request.POST.getlist('groups', [])
print(groups)
task = Task.objects.create(created_by=user, content=content) task = Task.objects.create(created_by=user, content=content)
task.add_groups(groups) task.add_groups(groups)
task.add_task_message(user.id) task.add_task_message(user.id)
url = request.POST.get('url')
# print(groups, content, url) # print(groups, content, url)
file = request.FILES.get('file') file = request.FILES.get('file')
picture = request.FILES.get('picture') picture = request.FILES.get('picture')