示例#1
0
class ShopCartLisetSerializer(serializers.ModelSerializer):

    goods = GoodsSerializers(many=False)

    class Meta:
        model = ShoppingCart
        fields = ['goods', 'nums']
示例#2
0
class UserFavDetailSerializer(serializers.ModelSerializer):
    # 通过goods_id拿到商品信息。就需要嵌套的Serializer
    goods = GoodsSerializers()

    class Meta:
        model = UserFav
        fields = ("goods", "id")
示例#3
0
class ShoppingCartDatilSerializers(serializers.ModelSerializer):
    # 一条购物车关系记录对应的只有一个goods。
    goods = GoodsSerializers(many=False, read_only=True)

    class Meta:
        model = ShoppingCart
        fields = ("goods", "nums")
示例#4
0
class OrderGoodsSerializer(serializers.ModelSerializer):

    goods = GoodsSerializers(many=False)

    # print('********************',goods)
    class Meta:

        model = OrderGoods
        fields = '__all__'
示例#5
0
class UserFavDetailSerializer(serializers.ModelSerializer):
    '''
    用户收藏
    '''

    goods = GoodsSerializers()

    class Meta:
        model = UserFav
        fields = ("goods", "id")
示例#6
0
class OrderGoodsSerialzier(serializers.ModelSerializer):
    goods = GoodsSerializers(many=False)

    class Meta:
        model = OrderGoods
        fields = "__all__"
示例#7
0
class UserFavDetailSerializers(serializers.ModelSerializer):
    goods = GoodsSerializers()
    class Meta:
        model = UserFav
        fields = ('goods', 'id')
示例#8
0
class ShoppingCartDetailSerializers(serializers.ModelSerializer):
    goods = GoodsSerializers(many=False)

    class Meta:
        model = ShoppingCart
        fields = '__all__'
示例#9
0
class ShopCartDetailSerializer(serializers.Serializer):
    goods = GoodsSerializers(many=False, read_only=True)

    class Meta:
        model = ShoppingCart
        fields = ('goods', 'nums')
示例#10
0
class UserFavListSerializers(serializers.ModelSerializer):
    goods = GoodsSerializers()

    class Meta:
        model = UserFav
        fields = '__all__'