进入shell之后代码命令简记
python manage.py shell
from rest_framework.renderers import JSONRenderer
from app02.serializers import ArticleSerializer
ser = ArticleSerializer(data=d)
ser.is_valid()验证传输数据是否正确
ser.save()保存
from app02.models import Article
art = Article.objects.all()
ser = ArticleSerializer(art,many=True)
json_data = JSONRenderer().render(ser.data)
json_data显示序列化好的json数据
上课概念笔记
成果效果图展示