One - One Code All

Blog Content

django中的objects.get和objects.filter方法的区别

Python   2019-03-16 16:05:55

django的get是从数据库的取得一个匹配的结果,返回一个字典形式对象,如果记录不存在的话,它会报错。 


django的filter方法是从数据库的取得匹配的结果,返回一个对象列表,如果记录不存在的话,它会返回[]。 



上一篇:python3.7.4-alpine安装gevent
下一篇:python使用JiaJa2通过模板生成文本文件

The minute you think of giving up, think of the reason why you held on so long.