django models使用学习记录

如何更新单个数据

example = User.objects.get(id=1)

example.is_acitve=1

example.save()

如何更新多个数据

examples = User.objects.filter(is_staff=1).update(is_superuser=1)

 

posted @ 2016-11-11 15:41  菲菲菲菲菲常新的新手  阅读(174)  评论(0编辑  收藏  举报