Fixed #26987 -- Documented using QuerySet.get() without arguments.

This commit is contained in:
Abhishek Bera 2016-08-19 23:51:33 +05:30 committed by Tim Graham
parent 1d1e246db6
commit f3b601f11a
1 changed files with 5 additions and 0 deletions

View File

@ -1671,6 +1671,11 @@ The :exc:`~django.db.models.Model.DoesNotExist` exception inherits from
except ObjectDoesNotExist:
print("Either the entry or blog doesn't exist.")
If you expect a queryset to return one row, you can use ``get()`` without any
arguments to return the object for that row::
entry = Entry.objects.filter(...).exclude(...).get()
``create()``
~~~~~~~~~~~~