方法一:
from
django.core
import
serializers
ret
=
models.BookType.objects.
all
()
data
=
serializers.serialize(
"json"
, ret)
方法二:
当只有一个object时:
from django.forms.models import model_to_dict
data = model_to_dict(your model object)标签:serializers,models,object,django,序列,model,data From: https://www.cnblogs.com/BillBie/p/17279037.html