From f3b601f11a7b56777ac1173a390787d176f95fe3 Mon Sep 17 00:00:00 2001 From: Abhishek Bera Date: Fri, 19 Aug 2016 23:51:33 +0530 Subject: [PATCH] Fixed #26987 -- Documented using QuerySet.get() without arguments. --- docs/ref/models/querysets.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index f11a09fb96e..c91d34fef92 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -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()`` ~~~~~~~~~~~~