示例#1
0
class Indexcarousel( db.Model,DuocDataBase ):
    id = db.Column( db.BigInteger,primary_key=True)
    image = db.Column( db.String )
    title = db.Column( db.String )
    content = db.Column( db.String )
    create_time = db.Column( db.DateTime, \
            default=datetime.now)
    update_time = db.Column( db.DateTime, \
            default=datetime.now,onupdate = datetime.now)

    def __init__( self,image,title,content):
        self.id = helper.dcid()
        self.image = image
        self.title = title 
        self.content = content 

    def __repr__( self ):
        return "<image %s>" % self.image

    @property
    def carousel( self ):
        return {
                'image_id'  :str(self.id),     
                'image'  :self.image,
                'title'  :self.title,
                'content'   :self.content
            }
示例#2
0
        self.description = description

    def __repr__(self):
        return "<investment type:id=%s,name=%s>" % (self.type_name,
                self.description)

    @property
    def im_type_meta(self):
        return{
                'im_type_id' :str(self.id),
                'type_name'  :self.type_name
                }

investment_investment_type = db.Table('investment_investment_type', #投资项目关联表
        db.Column('im_id', db.BigInteger, 
            db.ForeignKey('investment.id', ondelete='CASCADE'),
            primary_key=True,index=True),
        db.Column('type_id', db.BigInteger, 
            db.ForeignKey('investment_type.id', ondelete='CASCADE'),
            primary_key=True, index=True)
        )



class News( db.Model,DuocData):
    id = db.Column( db.BigInteger,primary_key=True)
    status = db.Column( db.SmallInteger,default=3,index=True)
    title = db.Column( db.String)
    cover_image = db.Column( db.String)
    content = db.Column( db.String) #此处存储的是h5的内容
    top = db.Column(db.Boolean,default=False)