コード例 #1
0
ファイル: create_db.py プロジェクト: coolsnake/WBMSBT
def init_data():
    print('init_data...')
    from database.db_config import db_session
    from database.tbl_admin import TblAdmin
    user = TblAdmin()
    user.name = "__MAIL__"
    user.value = "*****@*****.**"
    user.type = 1
    email = TblAdmin()
    email.name = "__MAILPASSWORD__"
    email.value = "xxxxxxxxxx"
    email.type = 1
    user_exist = db_session.query(
        TblAdmin.name).filter(TblAdmin.name == user.name).first()
    if user_exist is None:
        db_session.add(user)

    mail_exist = db_session.query(
        TblAdmin.name).filter(TblAdmin.name == email.name).first()
    if mail_exist is None:
        db_session.add(email)
    db_session.commit()
    db_session.close()

    print("done!")
コード例 #2
0
ファイル: init_table.py プロジェクト: FYPYTHON/WBMSBT
def init_admin():
    from database.tbl_admin import TblAdmin
    user = TblAdmin()
    user.name = "__MAIL__"
    user.value = "*****@*****.**"
    user.type = 1
    db_session.add(user)
    db_session.commit()
    db_session.close()
コード例 #3
0
ファイル: init_table.py プロジェクト: FYPYTHON/notes
def init_admin():
    from database.tbl_admin import TblAdmin
    user = TblAdmin()
    user.name = "appversion"
    user.value = "1.0"
    user.type = 1
    db_session.add(user)
    db_session.commit()
    db_session.close()
コード例 #4
0
ファイル: init_table.py プロジェクト: FYPYTHON/notes
def init_version():

    from database.tbl_admin import TblAdmin
    version = TblAdmin()
    version.name = "appversion"
    version.value = "1.0"
    version.type = 1
    db_session.add(version)
    db_session.commit()
    db_session.close()
コード例 #5
0
def init_info():
    from database.db_config import db_session
    from database.tbl_admin import TblAdmin
    user = TblAdmin()
    user.name = "appinfo"
    user.value = "1.0"
    user.type = 1
    user_exist = db_session.query(TblAdmin.name).filter(TblAdmin.name == user.name).first()
    if user_exist is None:
        db_session.add(user)

    user = TblAdmin()
    user.name = "appversion"
    user.value = "1.0"
    user.type = 1
    mail_exist = db_session.query(TblAdmin.name).filter(TblAdmin.name == user.name).first()
    if mail_exist is None:
        db_session.add(user)
    db_session.commit()
    db_session.close()
コード例 #6
0
def updateReceiver():
    e_receiver = db_session.query(TblAdmin).filter(
        TblAdmin.name == "emailreceiver").first()
    if e_receiver is None:
        e_receiver = TblAdmin()
        e_receiver.name = "emailreceiver"
        e_receiver.value = "*****@*****.**"
        db_session.add(e_receiver)
    else:
        e_receiver.value = "*****@*****.**"
    db_session.commit()
コード例 #7
0
ファイル: db_config.py プロジェクト: FYPYTHON/notes
def ini_tbladmin():
    from database.tbl_admin import TblAdmin
    result = db_session.query(TblAdmin).all()
    passsword = TblAdmin()
    passsword.name = "__TEXT__"
    passsword.value = "text"
    passsword.type = 1
    db_session.add(passsword)
    # db_session.commit()
    for res in result:
        print(res)