marshmallow :: schema :: BaseSchema :: Meta :: Class Meta
[hide private]
[frames] | no frames]

Class Meta


Options object for a Schema.

Example usage: ::

    class Meta:
        fields = ("id", "email", "date_created")
        exclude = ("password", "secret_attribute")

Available options:

- ``fields``: Tuple or list of fields to include in the serialized result.
- ``additional``: Tuple or list of fields to include *in addition* to the
    explicitly declared fields. ``additional`` and ``fields`` are
    mutually-exclusive options.
- ``include``: Dictionary of additional fields to include in the schema. It is
    usually better to define fields as class variables, but you may need to
    use this option, e.g., if your fields are Python keywords. May be an
    `OrderedDict`.
- ``exclude``: Tuple or list of fields to exclude in the serialized result.
- ``dateformat``: Date format for all DateTime fields that do not have their
    date format explicitly specified.
- ``strict``: If `True`, raise errors during marshalling rather than
    storing them.
- ``json_module``: JSON module to use for `loads` and `dumps`.
    Defaults to the ``json`` module in the stdlib.
- ``ordered``: If `True`, order serialization output according to the
    order in which fields were declared. Output of `Schema.dump` will be a
    `collections.OrderedDict`.
- ``index_errors``: If `True`, errors dictionaries will include the index
    of invalid items in a collection.
- ``load_only``: Tuple or list of fields to exclude from serialized results.
- ``dump_only``: Tuple or list of fields to exclude from deserialization

.. versionchanged:: 2.0.0
    `__preprocessors__` and `__data_handlers__` are deprecated. Use
    `marshmallow.decorators.pre_load` and `marshmallow.decorators.post_dump` instead.

Instance Methods [hide private]

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__