delete mathod qoshildi
This commit is contained in:
@@ -4,11 +4,15 @@ from core.apps.api.models import ProductsModel, SubProductModel
|
||||
|
||||
|
||||
class SubProductSerializer(serializers.ModelSerializer):
|
||||
type = serializers.CharField(source="product.subcategory.category.type", read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = SubProductModel
|
||||
fields = [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"type",
|
||||
"price",
|
||||
"image",
|
||||
]
|
||||
@@ -16,12 +20,15 @@ class SubProductSerializer(serializers.ModelSerializer):
|
||||
|
||||
class BaseProductsSerializer(serializers.ModelSerializer):
|
||||
subproducts = SubProductSerializer(many=True, read_only=True)
|
||||
type = serializers.CharField(source="subcategory.category.type", read_only=True)
|
||||
|
||||
class Meta:
|
||||
model = ProductsModel
|
||||
fields = [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"type",
|
||||
"price",
|
||||
"image",
|
||||
"subcategory",
|
||||
@@ -34,6 +41,8 @@ class ListProductsSerializer(BaseProductsSerializer):
|
||||
fields = [
|
||||
"id",
|
||||
"name",
|
||||
"description",
|
||||
"type",
|
||||
"price",
|
||||
"image",
|
||||
"subcategory",
|
||||
@@ -50,6 +59,7 @@ class CreateProductsSerializer(BaseProductsSerializer):
|
||||
"id",
|
||||
"subcategory",
|
||||
"name",
|
||||
"description",
|
||||
"price",
|
||||
"image",
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user