1.利用Django的view实现返回json数据 from django.views.generic import View from goods.models import Goods class GoodsListView(View): def get(self,request): #通过django的view实现商品列表页 json_list = [] #获取所有商品 goods = Goods.objects.all() for good in goods: json_dict = {…
阅读目录 Django支持的序列化格式 Django的序列化 Django支持的序列化格式 1 2 3 4 Identifier Information xml Serializes to and from a simple XML dialect. json Serializes to and from JSON. yaml Serializes to YAML (YAML Ain’t a Markup Language). This serializer is only avai…