The FieldDescriptor serves as a wrapper for Types that converts them into fields.
A field is then the merger of a Type and it’s Model.
Enclosure for fields and validation. Same pattern deployed by Django models, SQLAlchemy declarative extension and other developer friendly libraries.
Initial field values can be passed in as keyword arguments to __init__ to initialize the object with. Can raise ConversionError if it is not possible to convert the raw data into richer Python constructs.
Inspects a field and class for serialize_when_none setting.
The setting defaults to the value of the class. A field can override the class setting with it’s own serialize_when_none setting.
Iterator for the atomic components of a model definition and relevant data that creates a threeple of the field’s name, the instance of it’s type, and it’s value.
Converts the raw data into richer Python constructs according to the fields on the model
Parameters: | raw_data – The data to be converted |
---|
Return data as a pure key-value dictionary, where the values are primitive types (string, bool, int, long).
Parameters: |
|
---|
Return data as it would be validated. No filtering of output unless role is defined.
Parameters: | role – Filter output by a specific role |
---|
Validates the state of the model and adding additional untrusted data as well. If the models is invalid, raises ValidationError with error messages.
Parameters: |
|
---|
Meta class for Models.
This class is a container for all metaclass configuration options. Its primary purpose is to create an instance of a model’s options for every instance of a model.
To learn more about how Models are used, visit Using Models