def delete_single_tag_from_question(question_id, tag_id): if get_post_if_permitted(question_id, 'question'): remove_single_tag_from_question(question_id, tag_id) return redirect(url_for('display_question', question_id=question_id)) else: return render_template( "login.html", message="You don't have permission to perform this action")
def delete_question(question_id): if get_post_if_permitted(question_id, 'question'): question_process_delete_in_server(question_id) return redirect('/') else: return render_template( "login.html", message="You don't have permission to perform this action")
def display_comment_edit(comment_id): if client.get_post_if_permitted(comment_id, 'comment'): comment = com.get_comment_by_id(comment_id) return render_template('edit_comment.html', message=comment['message'], comment_id=comment_id) else: return render_template( "login.html", message="You don't have permission to perform this action")
def delete_comment(comment_id): if get_post_if_permitted(comment_id, 'comment'): redirection_id = get_question_id_from_entry('comment', comment_id) delete_comment_by_id(comment_id) return redirect(url_for('display_question', question_id=redirection_id)) else: return render_template( "login.html", message="You don't have permission to perform this action")
def display_answer_to_edit(answer_id): """Services displaying edition of answer and posting edited version.""" if client.get_post_if_permitted(answer_id, 'answer'): answer = ans.get_answer(answer_id) return render_template('edit_answer.html', answer_id=answer_id, answer=answer) else: return render_template( "login.html", message="You don't have permission to perform this action")
def display_question_to_edit(question_id): """Services displaying edition of question and posting edited version.""" if client.get_post_if_permitted(question_id, 'question'): question = qst.get_question_by_id(question_id) return render_template('edit_question.html', question_id=question_id, question=question) else: return render_template( "login.html", message="You don't have permission to perform this action")
def delete_answer(answer_id): """Services deleting answer.""" if get_post_if_permitted(answer_id, 'answer'): redirection_id = get_question_id_from_entry('answer', answer_id) delete_answer_by_id(answer_id) return redirect(url_for('display_question', question_id=redirection_id)) else: return render_template( "login.html", message="You don't have permission to perform this action")