[Answered ]-How to make reverse foregnkey/1to1/MtoM connections explicit in django models?

1👍

You can implement this in the serializer. You can implement this is:

class AccountSerializer(serializers.ModelSerializer):
    class Meta:
        model = Account
        fields = ['…']

and then we use that AccountSerializer in the PostSerializer:

class PostSerializer(serializers.ModelSerializer):
    user_set = AccountSerializer(many=True)    

    class Meta:
        model = Post
        fields = ['…']

Leave a comment