def route_delete_comment(comment_id): comment = data_manager.get_single_entry('comment', comment_id) if data_manager.comment_belongs_to_user(session.get('username'), comment_id): answer_id_of_comment = comment['answer_id'] question_id_of_comment = comment['question_id'] if request.method == "GET": if answer_id_of_comment: answer_data = data_manager.get_single_entry( 'answer', answer_id_of_comment) return render_template('database_ops/delete_comment.html', answer=answer_data['message'], comment=comment) question_data = data_manager.get_single_entry( 'question', question_id_of_comment) return render_template('database_ops/delete_comment.html', question=question_data, comment=comment) if request.form['delete-button'] == 'Yes': data_manager.delete_comment(comment_id) return redirect(url_for('display_question_and_answers', question_id=comment['question_id']), code=307)
def route_delete_comment(comment_id=None): comment_datas = data_manager.get_comment_datas(comment_id) data_manager.delete_comment(comment_id) question_id = comment_datas[0]['question_id'] return redirect( url_for('get_question_and_answer_and_comments_by_id', question_id=question_id))
def delete_comment(id, answer_id, comment_id): int(id) int(answer_id) if request.method == 'POST': data_manager.delete_comment(comment_id) return redirect(url_for('display_question', id=id, answer_id=answer_id))
def delete_comment(comment_id): user_id = data_manager.get_user_id_by_activity('comment', comment_id) question_id = data_manager.get_question_id_by_comment_id(comment_id) if session.get(FORM_USERNAME) and session[SESSION_ID] == user_id: data_manager.delete_comment(comment_id) return redirect(url_for("display_question", question_id=question_id)) else: flash("Delete option is available only for the author!", "rejection") return redirect(url_for('display_question', question_id=question_id))
def route_delete_comment(comment_id): question_id = dm.get_question_id_by_comment_id(comment_id) dm.delete_comment(comment_id) question_id = dict(question_id[0]) question_id = question_id['question_id'] return redirect(url_for( 'route_expand_question', question_id=question_id, ))
def del_comment(comment_id): q_and_a_id = data_manager.get_q_and_a_id_from_comment(comment_id) data_manager.delete_comment(comment_id) if q_and_a_id[0]['answer_id']: answer_id = q_and_a_id[0]['answer_id'] question_id = data_manager.get_question_id_from_answer_id(answer_id) question_id = question_id[0]['id'] else: question_id = q_and_a_id[0]['question_id'] return redirect(url_for('display_one_question', question_id=question_id))
def delete_comment(comment_id): answer_id = data_manager.get_id_from_comment( comment_id=comment_id)['answer_id'] try: question_id = (data_manager.get_question_id(answer_id))['question_id'] except: question_id = (data_manager.get_id_from_comment( comment_id=comment_id))['question_id'] data_manager.delete_comment(comment_id) return redirect('/question/' + str(question_id))
def delete_comment(comment_id): if request.method == 'POST': data = request.form.to_dict() ids = request.form.to_dict() comment_id = ids['comment_id'] question_id = data['question_id'] data_manager.delete_comment(comment_id) return redirect(url_for('display_question', question_id=question_id))
def delete_comment(comment_id): try: comment = data_manager.get_comment_by_comment_id(comment_id) if comment['question_id'] is not None: question_id = comment['question_id'] elif comment['question_id'] is None and comment['answer_id'] is not None: question_id = data_manager.get_question_id_by_answer_id(comment['answer_id']) if request.method == 'GET': return render_template('delete-comment.html', comment_id=comment_id, comment=comment, question_id=question_id) elif request.method == 'POST': data_manager.delete_comment(comment_id) return redirect(url_for('question_page', question_id=question_id)) except (IndexError, UndefinedError): abort(404)
def delete_comment(comment_id): site_user_id = data_manager.get_site_user_id_by_comment_id(comment_id) if site_user_id['site_user_id'] != session['user_id']: return redirect('https://i.imgflip.com/239qx5.jpg') question_id = str( data_manager.get_question_id_by_comment_id(comment_id)['question_id']) if question_id == 'None': answer_id = data_manager.get_answer_id_by_comment_id( comment_id)['answer_id'] question_id = str( data_manager.get_question_id_by_answer_id(answer_id) ['question_id']) data_manager.delete_comment(comment_id) return redirect('/question/' + question_id)
def delete_comment(comment_id, type_of_post): if type_of_post == 'question': question_id = data_manager.get_question_id_by_comment_id(comment_id) else: question_id = data_manager.get_question_id_by_answer_comment_id(comment_id) delete_comment = data_manager.delete_comment(comment_id) url_to_question_details = url_for("get_question_details", question_id=question_id) return redirect(url_to_question_details)
def delete_comment(comment_id): question_id = request.args.get("question_id") answer_id = request.args.get("answer_id") comments = data_manager.get_all_comments() data_manager.delete_comment(comment_id) if answer_id is None: answer_id = 0 decision = util.deciding_where_to_redirect(comments, comment_id, answer_id, question_id) if decision == "question": return redirect(url_for("display_question", question_id=question_id)) elif decision == "answer": return redirect(url_for("show_answer_and_comments", answer_id=answer_id, question_id=question_id))
def delete_comment(question_id, comment_id): user_id = session['id'] data_manager.delete_comment(comment_id, user_id) return redirect("/list/question/" + str(question_id))
def delete_comment(comment_id): try: dm.delete_comment(comment_id) except ValueError as e: print(e)
def delete_comment(comment_id): return data_manager.delete_comment(comment_id)
def delete_comment(num, comment_id_): data_manager.delete_comment(num, comment_id_) return redirect('/question/' + num + '/q-comment')
def delete_question_comment(comment_id: int): question_id = data_manager.get_question_id_by_comment_id(comment_id) question_id = question_id[0].get('question_id') data_manager.delete_comment(comment_id) return redirect( url_for('add_new_comment_to_question', question_id=question_id))
def route_delete_comment(comment_id, redirect_question_id): data_manager.delete_comment(comment_id) return redirect(url_for('route_show_details', question_id=redirect_question_id))
def delete_comment(id): question_id = data_manager.get_question_id_of_comment(id) data_manager.delete_comment(id) return redirect("/question/" + str(question_id["question_id"]))
def delete_comment(comment_id): if authenticate_user(): question_id = data_manager.delete_comment(comment_id)['question_id'] return redirect(url_for("show_question", question_id=question_id)) return redirect(url_for('login'))
def delete_answer_comment(comment_id: int): answer_id = data_manager.get_answer_id_by_comment_id(comment_id) answer_id = answer_id[0].get('answer_id') data_manager.delete_comment(comment_id) return redirect(url_for('add_new_comment_to_answer', answer_id=answer_id))
def delete_comment(question_id, comment_id): data_manager.delete_comment(comment_id) return redirect(url_for("manage_questions", question_id=question_id))
def route_delete_comment(question_id, comment_id): data_manager.delete_comment(comment_id) return redirect(url_for('display.route_display', question_id=question_id))
def delete_comment(comment_id): answ_id = data_manager.delete_comment(comment_id) answer_id = answ_id['answer_id'] return redirect(url_for('answer_comment_details', answer_id=answer_id))