class User(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String(100), nullable=False) email = db.Column(db.String(100), nullable=False) username = db.Column(db.String(30), unique=True, nullable=False) password = db.Column(db.String(100), nullable=False) def __init__(self, name, email, username, password): self.name = name self.email = email self.username = username self.password = password def __repr__(self): return "<User(id=%s, name='%s', email='%s', username='******'******')>" % ( self.id, self.name, self.email, self.username, self.password)
class User(db.Model, UserMixin): __tablename__ = 'User' id = db.Column(db.Integer, primary_key=True) #first_name = db.Column(db.String(50), nullable=True, unique=True) #last_name = db.Column(db.String(50), nullable=True, unique=True) username = db.Column(db.String(50), nullable=False, unique=True) email = db.Column(db.String(100), nullable=True, unique=True) password = db.Column(db.String(255), nullable=False, server_default='') active = db.Column(db.Boolean(), nullable=False, server_default='0') confirmed_at = db.Column(db.DateTime()) pref_location = db.Column(db.String(50), nullable=True, unique=False) pref_news_type = db.Column(db.String(50), nullable=True, unique=False)
class gb_news(db.Model): __tablename__ = 'gb_news' id = db.Column(db.Integer, primary_key=True) source = db.Column(db.String(100)) author = db.Column(db.String(100)) title = db.Column(db.String(100)) description = db.Column(db.String(100)) url = db.Column(db.String(100)) urlToImage = db.Column(db.String(100)) publishedAt = db.Column(db.Text) content = db.Column(db.String(100)) news_type = db.Column(db.String(100)) location = db.Column(db.String(100))