コード例 #1
0
def register_student():
    form = EmailFormStudent()

    if form.validate_on_submit():
        student = Student(username=form.username.data,
                          email=form.email.data,
                          password=form.password.data,
                          tutor_id=form.tutor_id.data)

        student.add_student()

        flash(
            f"{student.username}, You are successfully registered, please log in!"
        )
        return redirect(url_for('students.student_login'))

    return render_template("register_student.html", form=form)
コード例 #2
0
def register_student():
    email = None
    password = None

    form = EmailFormStudent()

    if form.validate_on_submit():
        name = form.name.data
        email = form.email.data
        password = form.password.data
        tutor_id = form.tutor_id.data

        item = Student(name, email, password, tutor_id)
        item.add_student()

        flash(f"{name}, You were successfully registered!")
        return redirect(url_for('students.register_student'))

    return render_template("register_student.html",
                           form=form,
                           email=email,
                           password=password)