示例#1
0
class Timeline(db.Model):
    __tablename__ = 'timeline_data'
    id = db.Column('id', db.Integer, primary_key=True)
    timeline_data = db.Column('timeline_data', db.Text, nullable=False)

    def __init__(self, timeline_data=''):
        self.timeline_data = timeline_data

    def __repr__(self):
        return '<Timeline %r>' % self.timeline_data
示例#2
0
class AboutReply(db.Model):
    __tablename__ = 'about_reply'
    id = db.Column(db.Integer, primary_key=True)
    author = db.Column(db.String(45), nullable=False)
    email = db.Column(db.String(100), nullable=False)
    url = db.Column(db.String(200), nullable=False)
    comment = db.Column(db.String(400), nullable=False)
    reply_date = db.Column(db.DateTime, nullable=False)
    so_good = db.Column(db.Integer, nullable=False)
    so_bad = db.Column(db.Integer, nullable=False)
    parent_id = db.Column(db.Integer)

    def __init__(self,
                 author,
                 email,
                 url,
                 comment,
                 so_good=0,
                 so_bad=0,
                 parent_id=None):
        self.author = author
        self.email = email
        self.url = url
        self.comment = comment
        self.parent_id = parent_id
        self.so_good = so_good
        self.so_bad = so_bad
        self.reply_date = datetime.now()

    def __repr__(self):
        return '<AboutReply %r>' % self.author
示例#3
0
class User(db.Model):
    __tablename__ = 'sp_user'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(45), nullable=False)
    password = db.Column(db.String(45), nullable=False)

    def __init__(self, name=None, password=None):
        self.name = name
        self.password = password

    def __repr__(self):
        return '<User %r>' % self.name
示例#4
0
class Comment(db.Model):
    __tablename__ = 'sp_comments'
    id = db.Column('id', db.Integer, primary_key=True)
    postid = db.Column('postid', db.Integer, primary_key=True)
    author = db.Column('author', db.String(20), nullable=True)
    email = db.Column('email', db.String(30), nullable=True)
    url = db.Column('url', db.String(75), nullable=True)
    visible = db.Column('visible', db.Integer, nullable=True)
    add_time = db.Column('add_time', db.Integer, nullable=False)
    content = db.Column('content', db.Text, nullable=False)

    def __init__(
        self,
        postid=None,
        author=None,
        email=None,
        url=None,
        visible=None,
        content=None,
    ):
        self.postid = postid
        self.author = author
        self.email = email
        self.url = url
        self.visible = visible
        self.add_time = int(time())
        self.content = content

    def __repr__(self):
        return '<Comment %r>' % self.content
示例#5
0
class Tag(db.Model):
    __tablename__ = 'sp_tags'
    id = db.Column('id', db.Integer, primary_key=True)
    name = db.Column('name', db.String(17), nullable=False)
    id_num = db.Column('id_num', db.Integer, nullable=False)
    content = db.Column('content', db.Text, nullable=False)

    def __init__(self, name=None, id_num=None, content=None):
        self.name = name
        self.id_num = id_num
        self.content = content

    def __repr__(self):
        return '<Tag %r>' % self.name
示例#6
0
class Link(db.Model):
    __tablename__ = 'sp_links'
    id = db.Column('id', db.Integer, primary_key=True)
    displayorder = db.Column('displayorder', db.Integer, nullable=False)
    name = db.Column('name', db.String(100), nullable=False)
    url = db.Column('url', db.String(100), nullable=False)

    def __init__(self, name=None, displayorder=None, url=None):
        self.name = name
        self.displayorder = displayorder
        self.url = url

    def __repr__(self):
        return '<Link %r>' % self.name
示例#7
0
class Article(db.Model):
    __tablename__ = 'sp_posts'
    _id = db.Column('id', db.Integer, primary_key=True)
    _category = db.Column('category', db.String(17), nullable=False)
    _title = db.Column('title', db.String(100), nullable=False)
    _content = db.Column('content', db.Text, nullable=False)
    _comment_num = db.Column('comment_num', db.Integer, nullable=False)
    _closecomment = db.Column('closecomment', db.Integer, nullable=False)
    _tags = db.Column('tags', db.String(100), nullable=True)
    _password = db.Column('password', db.String(8), nullable=True)
    _add_time = db.Column('add_time', db.Integer, nullable=False)
    _edit_time = db.Column('edit_time', db.Integer, nullable=False)
    _shorten_content = db.Column('shorten_content',
                                 db.String(200),
                                 nullable=True)
    _imgthumbnail = db.Column('imgthumbnail', db.String(200), nullable=True)
    _post_type = db.Column('post_type', db.Integer,
                           nullable=True)  # 1 for shown on top
    _click_num = db.Column('click_num', db.Integer,
                           nullable=True)  # 1 for shown on top
    _editor_title = db.Column('editor_title', db.String(100), nullable=True)

    def __init__(self,
                 _category='',
                 _title='',
                 _content='',
                 _comment_num=0,
                 _closecomment=0,
                 _tags=None,
                 _password=None,
                 _shorten_content='',
                 _imgthumbnail='',
                 _post_type=0,
                 _add_time=0,
                 _edit_time=0,
                 _click_num=0,
                 _editor_title=''):
        self._category = _category
        self._title = _title
        self._content = _content
        self._comment_num = _comment_num
        self._closecomment = _closecomment
        self._tags = _tags
        self._password = _password
        self._add_time = _add_time
        self._edit_time = _edit_time
        self._shorten_content = _shorten_content
        self._imgthumbnail = _imgthumbnail
        self._post_type = _post_type
        self._click_num = _click_num
        self._editor_title = _editor_title

    def __repr__(self):
        return '<Article %r>' % self._title