Esempio n. 1
0
def Login():
    name = request.form['name']
    gender = request.form['gender']
    picture = request.form['picture']
    email = request.form['email']
    age = request.form['age']
    user = session.query(User).filter_by(name=name).all()
    if len(user) == 0:
        newuser = User(name=name,
                       preference=0,
                       image=picture,
                       gender=gender,
                       age=age,
                       email=email)
        session.add(newuser)
        session.commit()
    else:
        user[0].name = name
        user[0].image = picture
        user[0].age = age
        user[0].gender = gender
        user[0].email = email
        print 'here'
        session.commit()
    return redirect(url_for('StartPage', user_name=name))
def createUser(login_session):
    newUser = User(name=login_session['username'],
                   email=login_session['email'],
                   picture=login_session['picture'])
    session.add(newUser)
    session.commit()
    user = session.query(User).filter_by(email=login_session['email']).one()
    return user.id
Esempio n. 3
0
def register():
    if request.method == "POST":
        name = request.form["name"]
        email = request.form["email"]
        password = request.form["password"]
        image = request.files["file"]
        path = os.getcwd() + "\\static\\images\\"
        image.save(path + image.filename)
        new_user = User(name=name,
                        email=email,
                        password=password,
                        image=(path + image.filename))
        session.add(new_user)
        session.commit()
        return f"{name} Successfully Registered..."
    else:
        return render_template("register.html")
Esempio n. 4
0
from sqlalchemy.orm import sessionmaker
import datetime

#engine = create_engine('sqlite:///branchcourse.db')
engine = create_engine('postgresql://*****:*****@localhost/catalog')
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)
session = DBSession()

# Get Current date
current_date = str(datetime.date.today())
# Create dummy user

User1 = User(
    name="Narayana",
    email="*****@*****.**",
    picture="https://plus.google.com/u/0/photos/102218847128353529116/\
  albums/profile/6639738781308160098?iso=false")
session.add(User1)
session.commit()

# Branch-1 [computer science]

cse = Branch(name="Computer Science", user_id=1)
session.add(cse)
session.commit()

# Indian Curreny symbol for ctrl+alt+4 in keyboard
# Branch-1 computer science[python for everybody[var:cse]] Details
fy4e_des = "The Python for Everybody course and "\
           "will introduce fundamental programming concepts "\