コード例 #1
0
class User(db.Model, UserMixin):
    __tablename__ = 'admintable'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(50), unique=True)
    password = db.Column(db.String(200))

    def __init__(self, name, password):
        self.name = name
        self.password = password
コード例 #2
0
class Tag(db.Model):
    __tablename__ = 'tag'
    tag_id = db.Column(db.Integer, primary_key=True)
    tag_name = db.Column(db.String(25))

    def __init__(self, tag_name):
        self.tag_name = tag_name

    def __repr__(self):
        return '<Tag %r>' % (self.tag_name)
コード例 #3
0
class Feedback(db.Model):
    __tablename__ = 'feedback'
    id = db.Column(db.Integer, primary_key=True)
    email = db.Column(db.String(50))
    message = db.Column(db.Text())

    def __init__(self, email, message):
        self.email = email
        self.message = message

    def __repr__(self):
        return '<Feedback %r>' % (self.id)
コード例 #4
0
class AnimeTable(db.Model):
    __tablename__ = 'anime_table'
    anime_id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(50), unique=True)
    subtitle = db.Column(db.Text())
    content = db.Column(db.Text())
    image = db.Column(db.String(250))
    video = db.Column(db.String(250))
    date = db.Column(db.DateTime)
    slug = db.Column(db.String(255))

    def __init__(self, title, subtitle, content, image, video, date, slug):
        self.title = title
        self.subtitle = subtitle
        self.content = content
        self.image = image
        self.video = video
        self.date = date
        self.slug = slug

    def __repr__(self):
        return '<Title %r>' % (self.anime_id)
コード例 #5
0
class Blogs(db.Model):
    __tablename__ = 'blogs'
    blog_id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(50), unique=True)
    subtitle = db.Column(db.Text())
    content = db.Column(db.Text())
    image = db.Column(db.String(100))
    date = db.Column(db.DateTime)
    slug = db.Column(db.String(255))
    tags = db.relationship('Tag',
                           secondary=tags_blogs,
                           backref=db.backref('taglist', lazy='dynamic'))

    def __init__(self, title, subtitle, content, image, date, slug):
        self.title = title
        self.subtitle = subtitle
        self.content = content
        self.image = image
        self.date = date
        self.slug = slug

    def __repr__(self):
        return '<Blog %r>' % (self.blog_id)