FloatRField
Resource field for storing floating-point values.
FloatRField stores floating-point numeric values with automatic validation and configurable storage. By default, floats are stored in the DATABASE for efficient querying and indexing.
This is useful for: - Measurements and scientific values - Scores, percentages, and ratios - Statistical results - Any decimal numeric metadata
Storage behavior: - Stored in DATABASE by default (searchable and queryable) - Included in dict views by default - Automatically validated as float on load/save
Example: ```python class MyResource(Resource): # Simple measurement temperature = FloatRField()
# With default value
threshold = FloatRField(default_value=0.95)
# Stored in KV_STORE instead
large_value = FloatRField(storage=RFieldStorage.KV_STORE)
# Not included in dict view
internal_score = FloatRField(include_in_dict_view=False)
```
include_in_dict_view: boolstorage: RFieldStoragevalidator: ValidatorInitialize a FloatRField for storing floating-point values.
float | Nonebool - TrueRFieldStorage - RFieldStorage.DATABASEDeserialize 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