What is the difference between get() and filter() on a QuerySet?
- A get() returns a single object and raises an exception if there is not exactly one match; filter() returns a QuerySet
- B filter() returns one object
- C get() returns a list
- D They are identical
Answer
get() returns a single object and raises an exception if there is not exactly one match; filter() returns a QuerySet
get() raises DoesNotExist or MultipleObjectsReturned. filter() returns a possibly empty QuerySet and never raises for zero matches.





