Beispiel #1
0
    if m != 'Model' and str(type(model)) == "<class 'peewee.BaseModel'>":
        if model.table_exists() == False:
            try:
                model.create_table()
            except Exception, e:
                pass
    elif str(type(model)) == "<type 'module'>":
        for m2 in dir(model):
            model2 = getattr(model, m2)
            if m2 not in ('Model') and str(
                    type(model2)) == "<class 'peewee.BaseModel'>":
                if model2.table_exists() == False:
                    try:
                        model2.create_table()
                    except Exception, e:
                        pass

# 执行安装
if 0 == wiki.models.Role.select().count():
    ar = wiki.models.Role()
    ar.code = 'admin'
    ar.name = '管理者'
    ar.save()

    ar = wiki.models.Role()
    ar.code = 'user'
    ar.name = '用户'
    ar.save()

Database.close()
Beispiel #2
0
            try:
                model.create_table()
            except Exception, e:
                pass
    elif str(type(model)) == "<type 'module'>":
        for m2 in dir(model):
            model2 = getattr(model, m2)
            if m2 not in ('Model') and str(type(model2)) == "<class 'peewee.BaseModel'>":
                if model2.table_exists() == False:
                    try:
                        model2.create_table()
                    except Exception, e:
                        pass


# 执行安装
if 0 == wiki.models.Role.select().count():
    ar = wiki.models.Role()
    ar.code = 'admin'
    ar.name = '管理者'
    ar.save()

    ar = wiki.models.Role()
    ar.code = 'user'
    ar.name = '用户'
    ar.save()



Database.close()
Beispiel #3
0
 def on__finish(self):
     # 关闭主从数据库连接
     Database.close()
Beispiel #4
0
 def on__finish(self):
     # 关闭主从数据库连接
     Database.close()