Fix Product serializer
This commit is contained in:
parent
466e62066f
commit
471ce05898
@ -20,22 +20,22 @@ class BrandSerializer(ModelSerializer):
|
|||||||
class ProductColorSerializer(ModelSerializer):
|
class ProductColorSerializer(ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ProductColor
|
model = ProductColor
|
||||||
fields = "__all__"
|
fields = ("color",)
|
||||||
|
|
||||||
|
|
||||||
class ProductStorageSerializer(ModelSerializer):
|
class ProductStorageSerializer(ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ProductStorage
|
model = ProductStorage
|
||||||
fields = "__all__"
|
fields = ("storage",)
|
||||||
|
|
||||||
|
|
||||||
class ProductSerializer(ModelSerializer):
|
class ProductSerializer(ModelSerializer):
|
||||||
colors = ProductColorSerializer(many=True, read_only=True)
|
color = ProductColorSerializer(many=True, read_only=True)
|
||||||
storages = ProductStorageSerializer(many=True, read_only=True)
|
storage = ProductStorageSerializer(many=True, read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Product
|
model = Product
|
||||||
fields = ("id", "name", "brand", "colors", "storages")
|
fields = ("id", "name", "brand", "color", "storage")
|
||||||
|
|
||||||
|
|
||||||
class ProductListSerializer(ModelSerializer):
|
class ProductListSerializer(ModelSerializer):
|
||||||
|
Loading…
Reference in New Issue
Block a user