Skip to content Skip to sidebar Skip to footer

Django Rest_framework Serializer With Inner Relationship

Here part of my models.py: class Discount(models.Model): discount_id = models.AutoField(primary_key=True) discount_category = models.ManyToManyField(Category) discount_

Solution 1:

Did you try to add the option depth to the Meta class? Maybe like this:

class DiscountSerializer(serializers.ModelSerializer):
    class Meta:
        model = Discount
        fields = ('discount_description', 'discount_start', 'discount_end', 'discount_title', 'discount_category', 'discount_store')
        depth = 1

Post a Comment for "Django Rest_framework Serializer With Inner Relationship"