标签:market else cat dsc 功能 TE work ima image
from rest_framework import serializers
from goods.models import Goods, GoodsCategory
class GoodsCategorySerializer(serializers.ModelSerializer):
class Meta:
model = GoodsCategory
fields = "__all__"
class GoodsSerializer(serializers.ModelSerializer):
category = GoodsCategorySerializer()
class Meta:
model = Goods
# fields = ("category", "name", "market_price", "add_time", "goods_front_image") # 序列化知道字段
fields = "__all__" # __all__ 序列化所有字段
标签:market else cat dsc 功能 TE work ima image
原文地址:https://www.cnblogs.com/YingLai/p/9136343.html