Skip to content

Commit b0cbfb4

Browse files
committed
resolved unicode and blank submit error
1 parent 4b70360 commit b0cbfb4

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

website/views.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def question_answer(request):
124124
answer = Answer()
125125
answer.uid = request.user.id
126126
answer.question = question
127-
answer.body = body.encode('unicode_escape')
127+
answer.body = body
128128
answer.save()
129129
if question.uid != request.user.id:
130130
notification = Notification()
@@ -158,7 +158,7 @@ def question_answer(request):
158158
email.attach_alternative(message, "text/html")
159159
email.send(fail_silently=True)
160160
# End of email send
161-
return HttpResponseRedirect('/question/' + str(qid) + "#answer" + str(answer.id))
161+
return HttpResponseRedirect('/question/' + str(qid) + "#answer" + str(answer.id))
162162
return HttpResponseRedirect('/')
163163

164164

@@ -171,7 +171,7 @@ def answer_comment(request):
171171
comment = AnswerComment()
172172
comment.uid = request.user.id
173173
comment.answer = answer
174-
comment.body = body.encode('unicode_escape')
174+
comment.body = body
175175
comment.save()
176176

177177
# notifying the answer owner
@@ -268,7 +268,7 @@ def new_question(request):
268268
question.minute_range = cleaned_data['minute_range']
269269
question.second_range = cleaned_data['second_range']
270270
question.title = cleaned_data['title']
271-
question.body = cleaned_data['body'].encode('unicode_escape')
271+
question.body = cleaned_data['body']
272272
question.views = 1
273273
question.save()
274274

@@ -445,7 +445,7 @@ def ajax_question_update(request):
445445
question = get_object_or_404(Question, pk=qid)
446446
if can_edit(user=request.user, obj=question):
447447
question.title = title
448-
question.body = body.encode('unicode_escape')
448+
question.body = body
449449
question.save()
450450
return HttpResponse("saved")
451451

@@ -481,7 +481,7 @@ def ajax_answer_update(request):
481481
body = request.POST['answer_body']
482482
answer = get_object_or_404(Answer, pk=aid)
483483
if can_edit(user=request.user, obj=answer):
484-
answer.body = body.encode('unicode_escape')
484+
answer.body = body
485485
answer.save()
486486
return HttpResponse("saved")
487487

@@ -495,7 +495,7 @@ def ajax_answer_comment_update(request):
495495
comment_body = request.POST["comment_body"]
496496
comment = get_object_or_404(AnswerComment, pk=comment_id)
497497
if can_edit(user=request.user, obj=comment):
498-
comment.body = comment_body.encode('unicode_escape')
498+
comment.body = comment_body
499499
comment.save()
500500
return HttpResponse("saved")
501501

0 commit comments

Comments
 (0)