I need to implement a functionality where ID of an account needs to be submitted while writing post and read additional info of an account with reading the post. How do I write the data with depth one but read data with more depth?
ModelSerializers:
class PostSerializer(serializers.ModelSerializer):
author = UserSerializer(required=False, allow_null=True)
class Meta:
model = Post
fields = ('id', 'author', 'message', 'rating', 'create_date', 'close_date',)
class UserSerializer(serializers.ModelSerializer):
class Meta:
model = User
fields = ('id', 'username', 'full_name',)