Exemple #1
0
def create_user():
    session = Session()
    new_user = User()
    new_user.fullname = flask.request.form["fullname"]
    new_user.name = flask.request.form["name"]
    new_user.password = flask.request.form["password"]
    session.add(new_user)
    session.commit()
    session.close()

    return flask.render_template("register.html",name = "completed")
Exemple #2
0
from db_model import User,Session

session = Session()

#INSERT
deneme = User()
deneme.fullname = "deneme-full"
deneme.name = "deneme-name"
deneme.password = "******"
session.add(deneme)
session.commit()

#WHERE
users = session.query(User).filter(User.id==2).first()
users.name = "degistirdim"

#DELETE
users = session.query(User).filter(User.id == 2).first()
session.delete(users)
session.commit()


#SELECT
print(session.query(User).all())


session.close()