-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.py
30 lines (26 loc) · 875 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from werkzeug.security import generate_password
app=Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI']='sqlite:///cli.db'
db=SQLAlchemy(app)
class user(db.Model):
id=db.Column('student_id',db.Integer,primary_key=True)
firstName=db.Column(db.String(100))
surName=db.Column(db.String(100))
email=db.Column(db.String(100))
password=db.Column(db.String(100))
timeStamp=db.Column(db.String(100))
def __init__(self,firstName,surName,email,password,timeStamp):
self.firstName=firstName
self.surName=surName
self.email=email
self.password=password
self.timeStamp=timeStamp
def add(fname,sname,email,password,timeStamp):
add=user(fname,sname,email,password,timeStamp)
db.session.add(add)
db.session.commit()
return "record added"
add("kwame","asiago","emai@","password","time")
print "added"