先寫了一個models.py3d
obj=models.School.objects.filer(name='Yizhong') for item in obj: print(item,type(item))
沒查到時用get方法會報錯:code
obj=models.School.objects.create(name='SanZhong') print(obj,type(obj),obj.name)
obj=models.School.objects.filter(**dic).update(name='SanZhong') print(obj,type(obj))
還有一種不經常使用的get方式,當修改沒有參數時會報錯:blog
obj=models.School.objects.get(name='SiZhong') obj.name='WuZhong' print(obj,type(obj))