django QuerySet对象转换成字典对象

django QuerySet对象转换成字典对象
>manage.py shell
>>> from django.contrib.auth.models import User
>>> from django.forms.models import model_to_dict
>>> u = User.objects.get(id=1)
>>> u_dict = model_to_dict(u)
>>> type(u)

>>> type(u_dict)

转发:http://hi.baidu.com/caoshansh/item/461958893c4dc5ded0f8cd73

你可能感兴趣的:(python,Django)