Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
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