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 = {…
Serialization 序列化 创建表 from django.db import models from pygments.lexers import get_all_lexers from pygments.styles import get_all_styles LEXERS = [item for item in get_all_lexers() if item[1]] LANGUAGE_CHOICES = sorted([(item[1][0], item[0]) for item…