Inner model types¶
Internal types for dirty models
-
class
dirty_models.model_types.
ListModel
(seq=None, *args, **kwargs)[source]¶ Bases:
dirty_models.base.InnerFieldTypeMixin
,dirty_models.base.BaseData
Dirty model for a list. It has the behavior to work as a list implementing its methods and has also the methods export_data, export_modified_data, import_data and flat_data to work also as a model, storing original and modified values.
-
delete_attr_by_path
(field)[source]¶ Function for deleting a field specifying the path in the whole model as described in
dirty:models.models.BaseModel.perform_function_by_path()
-
export_deleted_fields
()[source]¶ Returns a list with any deleted fields form original data. In tree models, deleted fields on children will be appended.
-
get_1st_attr_by_path
(field_path, **kwargs)[source]¶ It returns first value looked up by field path. Field path is dot-formatted string path:
parent_field.child_field
.Parameters: - field_path (str) – field path. It allows
*
as wildcard. - default – Default value if field does not exist.
If it is not defined
AttributeError
exception will be raised.
Returns: value
- field_path (str) – field path. It allows
-
get_attrs_by_path
(field_path, stop_first=False)[source]¶ It returns list of values looked up by field path. Field path is dot-formatted string path:
parent_field.child_field
.Parameters: - field_path (list or None.) – field path. It allows
*
as wildcard. - stop_first (bool) – Stop iteration on first value looked up. Default: False.
Returns: value
- field_path (list or None.) – field path. It allows
-