[Answered ]-Different serializers for serializing/deserializing using Django REST framework

2👍

OK, two points:

  1. Have you tried using PrimaryKeyRelatedField for your original_id? It would seem to target your use-case specifically. Combined with the depth option it may give you everything you need.

  2. You can switch serializers (e.g. based on request method) by overriding get_serializer_class() on your view. Not sure if you’ll get the exact behaviour you want here though.

Leave a comment