演示序列化器

  • 演示序列化器

    from booktest.serializers import BookInfoSerializer
    from booktest.models import BookInfo
    book = BookInfo.objects.get(id=2)
    serializer = BookInfoSerializer(book)
    serializer.data
    # {'id': 2, 'btitle': '天龙八部', 'bpub_date': '1986-07-24', 'bread': 36, 'bcomment': 40, 'image': None, 'heroinfo_set': [6,8, 9]}
    

results matching ""

    No results matching ""