當前位置: 首頁>>代碼示例>>Python>>正文


Python peewee.TextField方法代碼示例

本文整理匯總了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 
開發者ID:baidu-security,項目名稱:openrasp-iast,代碼行數:24,代碼來源:report_model.py

示例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 
開發者ID:baidu-security,項目名稱:openrasp-iast,代碼行數:19,代碼來源:config_model.py

示例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(" ")) 
開發者ID:17zuoye,項目名稱:detdup,代碼行數:24,代碼來源:fake_item_ids.py

示例4: migrate

# 需要導入模塊: import peewee [as 別名]
# 或者: from peewee import TextField [as 別名]
def migrate(migrator):
    return [migrator.add_column("event", "country", peewee.TextField(default="US"))] 
開發者ID:theacodes,項目名稱:conducthotline.com,代碼行數:4,代碼來源:0003_add_event_country.py

示例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)
        ),
    ] 
開發者ID:theacodes,項目名稱:conducthotline.com,代碼行數:11,代碼來源:0001_add_greeting_customization_fields.py

示例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)
        )
    ] 
開發者ID:theacodes,項目名稱:conducthotline.com,代碼行數:8,代碼來源:0004_add_number_features.py

示例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(),
    ] 
開發者ID:theacodes,項目名稱:conducthotline.com,代碼行數:9,代碼來源:0002_add_blocklist.py

示例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') 
開發者ID:keredson,項目名稱:peewee-db-evolve,代碼行數:17,代碼來源:test.py


注:本文中的peewee.TextField方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。