Django difference in filter () and get () of

In django, we often use the query API in two, often use get () and filter () method two, what is the difference between the two is it?

object.get()我们得到的是一个对象,如果在数据库中查不到这个对象或者查找到对象都会报错!!!
object.filter() 返回的是一个对象列表。如果在数据库中找不到这个对象,那么会返回一个空列表[]

Guess you like

Origin www.cnblogs.com/zhoajiahao/p/11502659.html