コード例 #1
0
ファイル: main.py プロジェクト: bexpe/python_ccms
def create_team():
    user = session['user']
    if user['type'] != 'Mentor':
        return redirect(url_for('index'))
    if request.method == 'POST':
        team_name = request.form['new_team_name']
        chosen_members = []
        member1 = request.form['member1']
        member2 = request.form['member2']
        member3 = request.form['member3']
        member4 = request.form['member4']
        if member1:
            chosen_members.append(Student.get_student_by_id(member1))
        if member2:
            chosen_members.append(Student.get_student_by_id(member2))
        if member3:
            chosen_members.append(Student.get_student_by_id(member3))
        if member4:
            chosen_members.append(Student.get_student_by_id(member4))
        if len(team_name) > 0:
            Team.add_new_team(team_name, chosen_members)
        return redirect('teams.html')
    return render_template('team_create.html',
                           student_list=Student.get_list_of_students(),
                           user=user)
コード例 #2
0
ファイル: main.py プロジェクト: bexpe/python_ccms
def remove_student(user_id):
    user = session['user']
    if user['type'] == 'Manager' or 'Mentor' or "Employee":
        student = Student.get_student_by_id(user_id)
        student.delete()
        return redirect(url_for('student_list'))
    return redirect(url_for('error.html'))
コード例 #3
0
ファイル: main.py プロジェクト: bexpe/python_ccms
def details_student(user_id):
    user = session['user']
    if user['type'] == 'Manager' or 'Manager' or "Employee":
        student_url = "student_list"
        return render_template('details_student.html',
                               person=Student.get_student_by_id(user_id),
                               url=student_url,
                               user=user)
    return redirect(url_for('error.html'))
コード例 #4
0
ファイル: main.py プロジェクト: bexpe/python_ccms
def assigments():
    user = session['user']
    if user['type'] not in ('Mentor', 'Student'):
        return redirect(url_for('index'))
    assigments_list = Assigment.get_list_of_assigments()
    if user['type'] == 'Student':
        student = Student.get_student_by_id(user['id'])
        return render_template('assignment_list.html',
                               assigments_list=assigments_list,
                               user=user,
                               student=student)
    return render_template('assignment_list.html',
                           assigments_list=assigments_list,
                           user=user)
コード例 #5
0
ファイル: main.py プロジェクト: bexpe/python_ccms
def edit_student(user_id):
    user = session['user']
    if user['type'] == 'Manager' or 'Mentor' or "Employee":
        student_url = "student_list"
        if request.method == "POST":
            login = request.form['login']
            email = request.form['email']
            name = request.form['name']
            surname = request.form['surname']
            date_of_birth = None
            city = None
            phone = None
            team_id = None
            card = None
            new_student = Student(user_id, name, surname, email, date_of_birth,
                                  city, phone, login, team_id, card)
            new_student.save()
            return redirect(url_for(student_url))
        return render_template('edit_student.html',
                               person=Student.get_student_by_id(user_id),
                               url=student_url,
                               user=user)
    return redirect(url_for('error.html'))