Skip to content

Added create python object class from serializer data. #7

Description

@nxexox

Added python class objects from serializer data.
Example:

fromrest_frameworkimportserializersclassExampleObject(object):
field_one=10def__str__(self):
return'ExampleObject(field_one={})'.format(self.field_one)
classExampleObjectSerializer(serializers.Serializer):
classMeta:
to_object=ExampleObjectser=ExampleObjectSerializer(data={'field_one': 100})
ser.is_valid()
obj=ser.get_object()
print(obj)
# 'ExampleObject(field_one=100)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions