class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = Category
fields = "__all__"
class MainSerializer(serializers.ModelSerializer):
categories = CategorySerializer(many=True)
class Meta:
model = Main
fields = ["all", "needed", "fields", "and", "categories"]