예제 #1
0
파일: views.py 프로젝트: rtbortolin/QandA
def make_question_comment(request):
    if request.method == "GET":
        raise Http404
    if request.method == "POST":
        form = CommentForm(request.POST)
        user = request.user.userprofile

        question_service = QuestionServices()
        comment = question_service.create_comment(form.data['comment'], form.data['question_id'], user)        
        return HttpResponseRedirect('/question/' + form.data['question_id'] + '?comment=' + str(comment.id))
예제 #2
0
def make_question_comment(request):
    if request.method == "GET":
        raise Http404
    if request.method == "POST":
        form = CommentForm(request.POST)
        user = request.user.userprofile

        question_service = QuestionServices()
        comment = question_service.create_comment(form.data['comment'],
                                                  form.data['question_id'],
                                                  user)
        return HttpResponseRedirect('/question/' + form.data['question_id'] +
                                    '?comment=' + str(comment.id))