コード例 #1
0
class User(Model):
    __table__ = "users"

    id = StringField(primary_key=True,default=next_id,ddl="varchar2(50)")
    email = StringField(ddl="varchar2(50)")
    password = StringField(ddl="varchar2(50)")
    admin = BooleanField()
    name = StringField(ddl="varchar2(50)")
    image = StringField("ddl=varchar2(500)")
    created_at = FloatField(default=time.time())
コード例 #2
0
class Blog(Model):
    __table__ = 'blogs'

    id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
    user_id = StringField(ddl='varchar(50)')
    user_name = StringField(ddl='varchar(500)')
    name = StringField(ddl='varchar(50)')
    summary = StringField(ddl='varchar(200)')
    content = TextField()
    create_at = FloatField(default=time.time)
コード例 #3
0
ファイル: modules.py プロジェクト: weiwangqiang/pythonServer
class User(Model):
    __table__ = 'user'

    id = IntegerField(primary_key=True, auto_increment=True)
    # id = StringField(primary_key=True, ddl='varchar(50)')
    email = StringField(ddl='varchar(50)')
    passwd = StringField(ddl='varchar(50)')
    perLevel = IntegerField()  #账号级别
    perPasswd = StringField(ddl='varchar(50)')
    name = StringField(ddl='varchar(50)')
コード例 #4
0
class User(Model):
    __table__ = 'users'

    id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
    email = StringField(ddl='varchar(50)')
    passwd = StringField(ddl='varchar(50)')
    admin = BooleanField()
    name = StringField(ddl='varchar(50)')
    image = StringField(ddl='varchar(500)')
    created_at = FloatField(default=time.time)
コード例 #5
0
class Comment(Model):
    __table__ = 'comments'

    id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
    blog_id = StringField(ddl='varchar(50)')
    user_id = StringField(ddl='varchar(50)')
    user_name = StringField(ddl='varchar(50)')
    user_image = StringField(ddl='varchar(500)')
    content = TextField()
    created_at = FloatField(default=time.time)
コード例 #6
0
ファイル: modules.py プロジェクト: weiwangqiang/pythonServer
class Device(Model):
    __table__ = 'device'
    id = IntegerField(primary_key=True, auto_increment=True)
    name = StringField(ddl='varchar(50)')
    kind = IntegerField()
    status = IntegerField()
    perLevel = IntegerField()
    time = LongField()
    week = StringField()
    port = IntegerField()
    task = IntegerField()
    schedule = IntegerField()  #是否有任务
コード例 #7
0
class Comment(Model):
    __table__ = 'comments'

    id = StringField(primary_key=True, default=next_id(), ddl='varchar(50)')
    blog_id = StringField(ddl='varchar(50)')
    user_id = StringField(ddl='varchar(50)')
    user_name = StringField(ddl='varchar(50)')
    user_image = StringField(ddl='varchar(500)')
    content = TextField()
    #日期和时间用float类型存储在数据库中,而不是datetime类型,
    # 这么做的好处是不必关心数据库的时区以及时区转换问题,排序非常简单,显示的时候,
    # 只需要做一个float到str的转换,也非常容易
    created_at = FloatField(default=time.time)
コード例 #8
0
class Comment(Model):
    __table__ = 'comments'

    id = IntegerField(primary_key=True, default=None)
    user_id = IntegerField()
    content = StringField()
    create_time = FloatField(default=time.time())
コード例 #9
0
class User(Model):
    __table__ = 'users'

    id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
    email = StringField(ddl='varchar(50)')
    passwd = StringField(ddl='varchar(50)')
    admin = BooleanField()
    name = StringField(ddl='varchar(50)')
    image = StringField(ddl='varchar(500)')
    created_at = FloatField(default=time.time)

    def __init__(self, **kw):
        super().__init__(**kw)
        self.instanceTestField = "instanceStrFiled"

    def customMethod(self, paramStr):
        print('params' + str(paramStr))
コード例 #10
0
class User(Model):
    __table__ = 'users'

    id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
    email = StringField(ddl='varchar(50)')
    passwd = StringField(ddl='varchar(50)')
    admin = BooleanField()
    name = StringField(ddl='varchar(50)')
    image = StringField(ddl='varchar(500)')
    created_at = FloatField(default=time.time)

    def show(self):
        print(1, '__mappings__:', self.__mappings__)
        print(2, '__table__:', self.__table__)
        print(3, '__primary_key__:', self.__primary_key__)
        print(4, '__fields__:', self.__fields__)
        print(5, '__select__:', self.__select__)
        print(6, '__insert__:', self.__insert__)
        print(7, '__update__:', self.__update__)
        print(8, '__delete__:', self.__delete__)
コード例 #11
0
ファイル: models.py プロジェクト: dingc1993/dinggit
class Blog(Model):
    __table__ = 'blogs'

    #id,user_id,user_name,user_image,name,summary,content,created_at
    id = StringField(primary_key=True, default=next_id, ddl='varchar(50)')
    user_id = StringField(ddl='varchar(50)')
    user_name = StringField(ddl='varchar(40)')
    user_image = StringField(ddl='varchar(500)')
    name = StringField(ddl='varchar(40)')
    summary = StringField(ddl='varchar(200)')
    content = TextField()  #默认是text类型
    created_at = FloatField(default=time.time)
コード例 #12
0
class Blog(Model):
    __table__ = 'blogs'

    id = StringField(name='id',
                     primary_key=True,
                     default=next_id,
                     ddl="varchar(50)")
    user_id = StringField(name='user_id', ddl="varchar(50)")
    user_name = StringField(name='user_name', ddl="varchar(50)")
    user_image = StringField(name='user_image', ddl="varchar(500)")
    name = StringField(name='name', ddl="varchar(50)")
    summary = StringField(name='summary', ddl="varchar(200)")
    content = TextField(name='content')
    created_at = FloatField(name='created_at', default=time.time)
コード例 #13
0
ファイル: models.py プロジェクト: 1018598742/pythonserver
class Runoob(Model):
    __table__ = 'runoob_tb1'
    runoob_id = IntegerField(primary_key=True)
    runoob_title = StringField(ddl='varchar(100)')
    runoob_author = StringField(ddl='varchar(40)')
    submission_date = StringField(ddl='varchar(20)')
コード例 #14
0
class User(Model):
    __table__ = 'users'

    id = IntegerField(primary_Key=True)
    name = StringField()
コード例 #15
0
class User(Model):
    __table__="user"
    id =StringField(primary_key=True,name="id",default=next_id())
コード例 #16
0
ファイル: test_orm.py プロジェクト: dingc1993/dinggit
 class User(Model):
     id = IntegerField('id', primary_key=True)
     name = StringField('username')
コード例 #17
0
 class User(Model):
     # 定义类的属性到列的映射:
     id = StringField('id', primary_key=True)
     name = StringField('username')
     email = StringField('email')
     password = StringField('password')