fix encoding bug

This commit is contained in:
baoliang 2021-04-08 10:56:26 +08:00
parent 6433c3cdd7
commit 8ae4ede5cc
2 changed files with 3 additions and 2 deletions

View File

@ -46,7 +46,7 @@ def create_task(request):
if not content: if not content:
return JsonResponse({'status': 'error', 'message': 'URL地址不能为空'}) return JsonResponse({'status': 'error', 'message': 'URL地址不能为空'})
groups = request.POST.getlist('groups', []) groups = request.POST.getlist('groups', [])
print(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)
@ -57,7 +57,7 @@ def create_task(request):
urlAddtion = TaskAddition.objects.create( urlAddtion = TaskAddition.objects.create(
task=task, category=0, url=url) task=task, category=0, url=url)
og_title, og_description, og_url, og_image = parse(url) og_title, og_description, og_url, og_image = parse(url)
print(og_title, og_description, og_url, og_image) # print(user.id, og_title, og_description, og_url, og_image)
task.add_url_message( task.add_url_message(
user.id, og_title, og_description, og_url, og_image) user.id, og_title, og_description, og_url, og_image)
if file: if file:
@ -75,6 +75,7 @@ def create_task(request):
g = Group.objects.get(id=group) g = Group.objects.get(id=group)
content = '%s在群组“%s”发布了任务,请查收消息' % (creater_profile, g.name) content = '%s在群组“%s”发布了任务,请查收消息' % (creater_profile, g.name)
Notice.create_normal_notice(u.user_id, content, group) Notice.create_normal_notice(u.user_id, content, group)
# print(u.user.username)
phones.append(u.user.username) phones.append(u.user.username)
send_tnps(phones, '任务', content) send_tnps(phones, '任务', content)
return JsonResponse({'status': 'success'}) return JsonResponse({'status': 'success'})