Chris Barry
Chris Barry

Reputation: 4594

How to access inital data in django rest framework serializer

I would like to auto populate some fields in a Serializer (Not a ModelSerializer)

I need a method I can hook into, that gives me both access to the data passed in, and the ability to manipulate which fields are shown dynamically (but I can see how to do that from the example in the docs)

Essentially, how can I access and manipulate the data that has been passed into the Serializer at it's initialisation.

http://www.django-rest-framework.org/api-guide/serializers/#example

Upvotes: 1

Views: 256

Answers (1)

Hugo Brilhante
Hugo Brilhante

Reputation: 606

I believe the method you are looking for is .to_internal_value.

Upvotes: 1

Related Questions