fields#
check_child_model_serializer#
URLReferencedModelListField#
Bases: ListField
Custom field for a model list.
Allows user to represent targets using the 'url' key.
The 'child' parameter in 'serializers.ListField' is used for serializing the list in the response.
Source code in src/apps/common/serializers/fields.py
URLReferencedModelField#
Bases: RelatedField
Serialized RelatedField for URL-referenced concepts.
Accepts input data in the format { "url": ... } which is then used to fetch a model instance. The instance is serialized using a model serializer. The serializer is expected to have a "url" field.
The field is essentially a wrapper around a concept serializer. Using a non-serializer field here prevents the parent serializer from complaining about unsupported writable nested serializers.
Source code in src/apps/common/serializers/fields.py
get_choices(cutoff=None)
#
Modified get_choices that converts dict to json for DRF forms.
Source code in src/apps/common/serializers/fields.py
get_value(dictionary)
#
Convert DRF forms input from json to dict.
many_init(**kwargs)
classmethod
#
For many=True use custom list field that retrieves multiple urls at once.
ChecksumField#
Bases: CharField
Source code in src/apps/common/serializers/fields.py
RemoteResourceChecksumField#
ListValidChoicesField#
Bases: ChoiceField
ChoiceField that lists valid choices in the 'invalid choice' error message.
Source code in src/apps/common/serializers/fields.py
MediaTypeField#
Bases: CharField
Source code in src/apps/common/serializers/fields.py
WKTField#
Bases: CharField
Serializer field that accepts a WKT string and normalizes it.
Source code in src/apps/common/serializers/fields.py
MultiLanguageField#
Bases: HStoreField
Serializer field for MultiLanguageField model fields.
Languages with null
or "" as translation are removed from the object.
Disallows empty objects {}
by default.
Source code in src/apps/common/serializers/fields.py
NullableCharField#
Bases: CharField
CharField that converts empty strings to nulls if allowed.