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() 返回的是一个对象列表。如果在数据库中找不到这个对象,那么会返回一个空列表[]
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() 返回的是一个对象列表。如果在数据库中找不到这个对象,那么会返回一个空列表[]