def remove_student(user_id): student = users.get_or_404(user_id) tutor = current_user.user relation = tutoring_relations.get_or_404(tutor=tutor, student=student, accepted=True) relation.delete() return current_user.user
def cancel_student_request(user_id): student = users.get_or_404(user_id) tutor = current_user.user relation = tutoring_relations.get_or_404(tutor=tutor, student=student, initiated_by='tutor', accepted=False) relation.delete() return current_user.user
def decline_student(user_id): student = current_user.user tutor = users.get_or_404(user_id) relation = tutoring_relations.get_or_404(tutor=tutor, student=student, initiated_by='tutor', accepted=False) relation.delete() return current_user.user
def accept_tutor(user_id): student = users.get_or_404(user_id) tutor = current_user.user relation = tutoring_relations.get_or_404(tutor=tutor, student=student, initiated_by='student', accepted=False) relation.accepted = True relation.save() return current_user.user