drf.serializers¶
- class polymorphic.contrib.drf.serializers.PolymorphicSerializer¶
Bases:
Serializer- static __new__(cls, *args, **kwargs)¶
When a field is instantiated, we store the arguments that were used, so that we can present a helpful representation of the object.
- __init__(*args, **kwargs)¶
- create(validated_data)¶
- is_valid(*args, **kwargs)¶
- run_validation(data=<class 'rest_framework.fields.empty'>)¶
We override the default run_validation, because the validation performed by validators and the .validate() method should be coerced into an error dictionary with a ‘non_fields_error’ key.
- to_internal_value(data)¶
Dict of native values <- Dict of primitive datatypes.
- to_representation(instance)¶
Object instance -> Dict of primitive datatypes.
- to_resource_type(model_or_instance)¶
- update(instance, validated_data)¶
- resource_type_field_name = 'resourcetype'¶