Skip to content Skip to sidebar Skip to footer

Data Is Not Expected In Nested Serializer

I m making a post request. but the data is not giving me as expected. views.py @api_view(['POST']) def ruleAssignment(request): if request.method == 'POST': data = JSON

Solution 1:

Try this:

class RuleAssignmentParamsSerializers(serializers.ModelSerializer):
    ruleAssignmentDetails = serializers.SerializerMethodField()
    targetDefination = serializers.SerializerMethodField()

    class Meta:
        model = RuleAssignmentParams
        fields = (
            'id',
            'ruleAssignmentDetails',
            'detailSrl',
            'parameterName',
            'valueType',
            'overwriteValue',
            'targetDefination',
        )
        depth = 1 <--- add this line in your code

Post a Comment for "Data Is Not Expected In Nested Serializer"