class User(db.Model): id = db.Column(db.Integer, primary_key=True) first_name = db.Column(db.String(100)) last_name = db.Column(db.String(100)) login = db.Column(db.String(80), unique=True) email = db.Column(db.String(120)) password = db.Column(db.String(64)) admin = db.Column(db.Boolean) # Flask-Login integration def is_authenticated(self): return True def is_active(self): return True def is_anonymous(self): return False def get_id(self): return self.id # Required for administrative interface def __unicode__(self): return self.username '''
class Category(db.Model): __tablename__ = 'b_category' id = db.Column(db.Integer, primary_key=True) title = db.Column(db.String(20), unique=True) content = db.Column(db.String(100)) def __init__(self, title, content): self.title = title self.content = content
class User(db.Model, UserMixin): __tablename__ = 'b_user' id = db.Column(db.Integer, primary_key=True) username = db.Column(db.String(10), unique=True) password = db.Column(db.String(16)) def __init__(self, username, password): self.username = username self.password = password def __repr__(self): return '<User %r>' % self.username
class Category(db.Model): #__tablename__ = 'b_category' __tablename__ = 'category' id = db.Column(db.Integer,primary_key=True) title = db.Column(db.String(20),unique=True) content = db.Column(db.String(100)) userid = db.Column(db.Integer) username = db.Column(db.String(80)) ''' def __init__(self,title,content,userid,username): self.title = title self.content = content self.userid = userid self.username = username ''' def __repr__(self): return '<Category %r>' % self.title
class SpiderP9(db.Model): #__tablename__ = 'b_category' __tablename__ = 'p9' id = db.Column(db.Integer,primary_key=True) title = db.Column(db.String(20)) url = db.Column(db.String(100)) com = db.Column(db.String(5)) user = db.Column(db.String(20)) tag =db.Column(db.String(50)) def __init__(self,title,url,com,user,tag): self.title = title self.url = url self.com = com self.user = user self.tag = tag def __repr__(self): return '<Category %r>' % self.title
class Keywords(db.Model): #__tablename__ = 'b_category' __tablename__ = 'keywords' id = db.Column(db.Integer,primary_key=True) key = db.Column(db.String(20),unique=True) times = db.Column(db.Integer) warning = db.Column(db.Boolean) def __init__(self): self.key = 'NULL' self.times=0 self.warning=False ''' def __init__(self,key): self.key = key self.times=0 self.warning=False ''' def __repr__(self): return '<Keywords %r>' % self.key