Fix Product serializer

This commit is contained in:
jhyns 2023-05-17 17:16:49 +09:00
parent 466e62066f
commit 471ce05898

View File

@ -20,22 +20,22 @@ class BrandSerializer(ModelSerializer):
class ProductColorSerializer(ModelSerializer):
class Meta:
model = ProductColor
fields = "__all__"
fields = ("color",)
class ProductStorageSerializer(ModelSerializer):
class Meta:
model = ProductStorage
fields = "__all__"
fields = ("storage",)
class ProductSerializer(ModelSerializer):
colors = ProductColorSerializer(many=True, read_only=True)
storages = ProductStorageSerializer(many=True, read_only=True)
color = ProductColorSerializer(many=True, read_only=True)
storage = ProductStorageSerializer(many=True, read_only=True)
class Meta:
model = Product
fields = ("id", "name", "brand", "colors", "storages")
fields = ("id", "name", "brand", "color", "storage")
class ProductListSerializer(ModelSerializer):