本文整理汇总了Python中peewee.TextField方法的典型用法代码示例。如果您正苦于以下问题:Python peewee.TextField方法的具体用法?Python peewee.TextField怎么用?Python peewee.TextField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类peewee
的用法示例。
在下文中一共展示了peewee.TextField方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_model
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def _create_model(self, db, table_prefix):
"""
创建数据model
"""
meta_dict = {
"database": db,
"table_name": table_prefix + "_" + "Report"
}
meta = type("Meta", (object, ), meta_dict)
model_dict = {
"id": peewee.AutoField(),
"plugin_name": peewee.CharField(max_length=63),
"description": peewee.TextField(),
"rasp_result_list": self.LongTextField(),
"payload_seq": peewee.CharField(unique=True, max_length=63),
"message": peewee.TextField(),
"time": peewee.IntegerField(default=common.get_timestamp),
"upload": peewee.IntegerField(default=0),
"Meta": meta
}
self.Report = type("Report", (peewee.Model, ), model_dict)
return self.Report
示例2: _create_model
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def _create_model(self, db, table_prefix):
"""
创建数据model
"""
meta_dict = {
"database": db,
"table_name": "Config"
}
meta = type("Meta", (object, ), meta_dict)
model_dict = {
"host_port_hash": peewee.CharField(primary_key=True, max_length=63),
"host_port": peewee.TextField(),
"config_json": peewee.TextField(),
"Meta": meta
}
self.Config = type("Config", (peewee.Model, ), model_dict)
return self.Config
示例3: __init__
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def __init__(self, data_model):
self.data_model = data_model
self.data_model.fake_item_ids_store = self
assert self.data_model.cache_dir, "FakeItemIds need cache_dir from data_model!"
sqlite_path = os.path.join(self.data_model.cache_dir, "fake_item_ids_store.db")
sqlite_database = SqliteDatabase(sqlite_path, check_same_thread=False)
class FakeItemIdsStore(Model):
is_deleted = BooleanField(default=False) # mark processed or duplicated items
item_id = CharField()
item_content_json = TextField()
created_at = TimeField(default=datetime.datetime.now)
class Meta:
database = sqlite_database
self.storage = FakeItemIdsStore
if not self.storage.table_exists():
self.storage.create_table()
sqlite_database.create_index(self.storage, "is_deleted item_id".split(" "))
示例4: migrate
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def migrate(migrator):
return [migrator.add_column("event", "country", peewee.TextField(default="US"))]
示例5: migrate
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def migrate(migrator):
return [
migrator.add_column(
"event", "voice_greeting", peewee.TextField(null=True, index=False)
),
migrator.add_column(
"event", "sms_greeting", peewee.TextField(null=True, index=False)
),
]
示例6: migrate
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def migrate(migrator):
return [
migrator.add_column(
"number", "features", peewee.TextField(default="SMS,VOICE", index=False)
)
]
示例7: migrate
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def migrate(migrator):
return [
migrator.add_column(
"auditlog", "reporter_number", peewee.TextField(null=True, index=False)
),
CreateModels(),
]
示例8: test_change_column_type_char_text
# 需要导入模块: import peewee [as 别名]
# 或者: from peewee import TextField [as 别名]
def test_change_column_type_char_text(self):
class SomeModel(pw.Model):
some_field = pw.CharField(default='woot')
class Meta:
database = self.db
self.evolve_and_check_noop()
model = SomeModel.create()
self.assertEqual(model.some_field, 'woot')
peeweedbevolve.clear()
class SomeModel(pw.Model):
some_field = pw.TextField(default='woot')
class Meta:
database = self.db
self.evolve_and_check_noop()
self.assertEqual(SomeModel.select().first().some_field, 'woot')