Python peewee.TextField() Examples

The following are 8 code examples of peewee.TextField(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module peewee , or try the search function .
Example #1
Source File: report_model.py    From openrasp-iast with Apache License 2.0 6 votes vote down vote up
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 
Example #2
Source File: config_model.py    From openrasp-iast with Apache License 2.0 6 votes vote down vote up
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 
Example #3
Source File: fake_item_ids.py    From detdup with MIT License 6 votes vote down vote up
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(" ")) 
Example #4
Source File: 0003_add_event_country.py    From conducthotline.com with Apache License 2.0 5 votes vote down vote up
def migrate(migrator):
    return [migrator.add_column("event", "country", peewee.TextField(default="US"))] 
Example #5
Source File: 0001_add_greeting_customization_fields.py    From conducthotline.com with Apache License 2.0 5 votes vote down vote up
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)
        ),
    ] 
Example #6
Source File: 0004_add_number_features.py    From conducthotline.com with Apache License 2.0 5 votes vote down vote up
def migrate(migrator):
    return [
        migrator.add_column(
            "number", "features", peewee.TextField(default="SMS,VOICE", index=False)
        )
    ] 
Example #7
Source File: 0002_add_blocklist.py    From conducthotline.com with Apache License 2.0 5 votes vote down vote up
def migrate(migrator):
    return [
        migrator.add_column(
            "auditlog", "reporter_number", peewee.TextField(null=True, index=False)
        ),
        CreateModels(),
    ] 
Example #8
Source File: test.py    From peewee-db-evolve with GNU Lesser General Public License v3.0 5 votes vote down vote up
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')