Django-REST-framework serializer fields for compound types.
- Free software: BSD license
- Documentation
- Source code
- Issue tracker
- CI server
- IRC: no channel but see AUTHORS for individual nicks on freenode.
- Mailing list: None yet, but please log an issue if you want to have discussions about this package.
These fields represent compound datatypes, which build on other fields with some additional aspect such collecting multiple elements.
- ListField
A list representation, whose elements are described by a given item field. This means that all elements must meet the definition of that field. The item field can be another field type (e.g., CharField) or a serializer. If item_field is not given, then the list-items are passed through as-is, and can be anything. Note that in this case, any non-native list elements wouldn't be properly prepared for data rendering.
Signature: ListField(item_field=None)
- DictField
A dictionary representation, whose values are described by a given value field. This means that all values must meet the definition of that field. The value field can be another field type (e.g., CharField) or a serializer. If value_field is not given, then the dict values are passed through-as-is, and can be anything. Note that in this case, any non-native dict values wouldn't be properly prepared for data rendering.
Dictionary keys are presumed to be character strings or convertible to such, and so during processing are casted to unicode. If necessary, options for unicode conversion (such as the encoding, or error processing) can be provided to a DictField. For more info, see [py_unicode].
Signature: DictField(value_field=None, unicode_options=None)
If given, unicode_options must be a dict providing options per the [unicode](http://docs.python.org/2/library/functions.html#unicode) function.
[py_unicode]: http://docs.python.org/2/howto/unicode.html