StrRField
Resource field for storing string values.
StrRField stores string values with automatic validation and configurable storage. By default, strings are stored in the KV_STORE as they can be large and are not typically used for database queries.
This is useful for: - Text content and descriptions - Names, labels, and identifiers - File paths and URLs - Any textual metadata
Storage behavior: - Stored in KV_STORE by default (efficient for larger strings) - Included in dict views by default - Automatically validated as string on load/save - For very large strings, consider setting include_in_dict_view=False
Example: ```python class MyResource(Resource): # Simple string field description = StrRField()
# With default value
status = StrRField(default_value='pending')
# Stored in DATABASE for searchability
name = StrRField(storage=RFieldStorage.DATABASE)
# Large content not in dict view
content = StrRField(include_in_dict_view=False)
```
include_in_dict_view: boolstorage: RFieldStoragevalidator: ValidatorInitialize a StrRField for storing string values.
str | Nonebool - TrueRFieldStorage - RFieldStorage.KV_STOREDeserialize and validate a value from storage.
Validates the stored value using the field's validator before returning it.
AnyAnyGet the default value for this field.
If the default value is a Type or Callable, it will be called to generate a new default value. Otherwise, the default value is returned directly.
This ensures that mutable defaults (like lists or dicts) are not shared between Resource instances.
AnySerialize and validate a value for storage.
Validates the value using the field's validator before storing it.
AnyAny