diff options
| author | Abhishek Bera <abhisecre@gmail.com> | 2016-08-19 23:51:33 +0530 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-19 17:15:33 -0400 |
| commit | f3b601f11a7b56777ac1173a390787d176f95fe3 (patch) | |
| tree | ae5954b17d6b7bed75a790af421399f5f7b4b1c3 /docs | |
| parent | 1d1e246db6ae8a8c7b9a54f3485809a36c5ee373 (diff) | |
Fixed #26987 -- Documented using QuerySet.get() without arguments.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/models/querysets.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index f11a09fb96..c91d34fef9 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()`` ~~~~~~~~~~~~ |
