Model
Model
Bases: BaseModel
Model is a BaseModel overload with opinions on mutability and alias generation.
Configurations
- frozen: Model instances are frozen by default.
- from_attributes: Enables from_attributes mode for this model.
- alias_generator: Uses utils.to_camel for alias generation.
- populate_by_name: Allows population of fields by field name.
- ignore_types: Keeps attributes of type lazy untouched during population.
__setattr__(name, value)
Overloads the setattr method to allow lazy fields to work correctly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the attribute. |
required |
value |
Any
|
The value to set for the attribute. |
required |
MutableModel
Bases: Model
A mutable version of the Model class that allows unfreezing of instances.
Configurations
- frozen: Model instances are not frozen, allowing mutability.
Model
Bases: BaseModel
Model is a BaseModel overload with opinions on JSON parsing mutability and alias generation.
Configurations
- json_loads: Uses utils.json.loads for JSON loading.
- json_dumps: Uses utils.json.dumps for JSON dumping.
- frozen: Model instances are frozen by default.
- orm_mode: Enables ORM mode for this model.
- alias_generator: Uses utils.to_camel for alias generation.
- allow_population_by_field_name: Allows population of fields by field name.
- keep_untouched: Keeps attributes of type lazy untouched during population.
__setattr__(name, value)
Overloads the setattr method to allow lazy fields to work correctly.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
The name of the attribute. |
required |
value |
Any
|
The value to set for the attribute. |
required |
MutableModel
Bases: Model
A mutable version of the Model class that allows unfreezing of instances.
Configurations
- frozen: Model instances are not frozen, allowing mutability.