Spaces:
Sleeping
Sleeping
File size: 1,045 Bytes
3cf589c |
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 30 |
from app import db
from werkzeug.security import generate_password_hash, check_password_hash
class User(db.Model):
id = db.Column(db.Integer, primary_key=True)
username = db.Column(db.String(64), index=True, unique=True)
email = db.Column(db.String(120), index=True, unique=True)
password_hash = db.Column(db.String(128))
marks = db.Column(db.Integer, index=True)
def __repr__(self):
return '<User {}>'.format(self.username)
def set_password(self, password):
self.password_hash = generate_password_hash(password)
def check_password(self, password):
return check_password_hash(self.password_hash, password)
class Questions(db.Model):
q_id = db.Column(db.Integer, primary_key=True)
ques = db.Column(db.String(350), unique=True)
a = db.Column(db.String(100))
b = db.Column(db.String(100))
c = db.Column(db.String(100))
d = db.Column(db.String(100))
ans = db.Column(db.String(100))
def __repr__(self):
return '<Question: {}>'.format(self.ques) |