示例#1
0
def register():
    form = RegistrationForm()
    if form.validate_on_submit():
        user = User(
            email=form.email.data,
            password=form.password.data,
        )
        session.add(user)
        session.commit()
        flash('You can now log in.')
        return redirect('/login')

    return render_template('login_or_register.html',
                           title='Register',
                           name='register',
                           form=form)
示例#2
0
#!/usr/bin/env python3

from db_connect import Departments, session

dep_hr = Departments(dep_name='hr')
dep_op = Departments(dep_name='op')
dep_finance = Departments(dep_name='财务')
dep_xz = Departments(dep_name='行政')

session.add_all([dep_hr, dep_op, dep_finance, dep_xz])
session.commit()
session.close()