Ejemplo n.º 1
0
class ProductDetailForListSerializer(serializers.ModelSerializer):
    taxes = serializers.HyperlinkedIdentityField(
        view_name='product:product tax list', lookup_field='product_id')
    # contents             =   serializers.HyperlinkedIdentityField(view_name='product:product contents',lookup_field='product_id')
    images = serializers.HyperlinkedIdentityField(
        view_name='product:product images', lookup_field='product_id')
    add_to_cart = serializers.HyperlinkedIdentityField(
        view_name='cart:add_to_cart', lookup_field='product_id')
    remove_from_cart = serializers.HyperlinkedIdentityField(
        view_name='cart:remove_from_cart', lookup_field='product_id')
    edit = serializers.HyperlinkedIdentityField(
        view_name="product:edit product", lookup_field="product_id")
    shop_name = ShopDetailSerializer(read_only=True)
    content_category = serializers.HyperlinkedIdentityField(
        view_name='product:content category list', lookup_field='product_id')
    delete = serializers.HyperlinkedIdentityField(
        view_name="product:delete product", lookup_field="product_id")

    class Meta:
        model = Product
        fields = [
            'product_id', 'user', 'product_code', 'quantity', 'product_image',
            'product_name', 'product_price', 'description', 'shop_name',
            "Category", 'active', 'content_category', 'edit', 'delete',
            'Aisle_number', 'Shelf_number', 'Shelf_side', 'remove_from_cart',
            'images', 'taxes', 'add_to_cart'
        ]
Ejemplo n.º 2
0
class ProductSerializer(serializers.ModelSerializer):
    url = serializers.HyperlinkedIdentityField(
        view_name='product:detail product', lookup_field='product_id')
    shop_name = ShopDetailSerializer(read_only=True)

    class Meta:
        model = Product
        fields = [
            'product_id', 'user', 'product_image', 'product_name',
            'product_price', 'description', 'shop_name', 'url'
        ]
        read_only_fields = ['shop_name']
Ejemplo n.º 3
0
class ProductListOfUserSerializer(serializers.ModelSerializer):
    url = serializers.HyperlinkedIdentityField(
        view_name='product:detail of product', lookup_field='product_id')
    shop_name = ShopDetailSerializer(read_only=True)

    class Meta:
        model = Product
        fields = [
            'product_id', 'product_code', 'user', 'product_image',
            'product_name', 'product_price', 'description', 'shop_name',
            'quantity', 'url', 'Aisle_number', 'Shelf_number', 'Shelf_side'
        ]
        read_only_fields = ['shop_name']
Ejemplo n.º 4
0
class ProductDetailSerializer(serializers.ModelSerializer):
    add_to_cart = serializers.HyperlinkedIdentityField(
        view_name='cart:add_to_cart', lookup_field='product_id')
    remove_from_cart = serializers.HyperlinkedIdentityField(
        view_name='cart:remove_from_cart', lookup_field='product_id')
    shop_name = ShopDetailSerializer(read_only=True)

    class Meta:
        model = Product
        fields = [
            'product_image', 'add_to_cart', 'product_name', 'product_price',
            'description', 'shop_name', 'remove_from_cart'
        ]
Ejemplo n.º 5
0
class ProductDetailForListSerializer(serializers.ModelSerializer):
    edit = serializers.HyperlinkedIdentityField(
        view_name="product:edit product", lookup_field="product_id")
    shop_name = ShopDetailSerializer(read_only=True)
    delete = serializers.HyperlinkedIdentityField(
        view_name="product:delete product", lookup_field="product_id")

    class Meta:
        model = Product
        fields = [
            'user', 'product_code', 'quantity', 'product_image',
            'product_name', 'product_price', 'description', 'shop_name',
            "Category", 'active', 'edit', 'delete'
        ]