查询

models.UserInfo.objects.all()
models.UserInfo.objects.all().values('user')    #只取user列
models.UserInfo.objects.all().values_list('id','user')    #取出id和user列,并生成一个列表
models.UserInfo.objects.get(id=1)
models.UserInfo.objects.get(user='yangmv')

增加数据

models.UserInfo.objects.create(user='yangmv',pwd='123456')
或者
obj = models.UserInfo(user='yangmv',pwd='123456')
obj.save()
或者
dic = {'user':'yangmv','pwd':'123456'}
models.UserInfo.objects.create(**dic)

删除数据

models.UserInfo.objects.filter(user='yangmv').delete()

修改数据

models.UserInfo.objects.filter(user='yangmv').update(pwd='520')
或者
obj = models.UserInfo.objects.get(user='yangmv')
obj.pwd = '520'
obj.save()