Kaydet (Commit) f3b601f1 authored tarafından Abhishek Bera's avatar Abhishek Bera Kaydeden (comit) Tim Graham

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

üst 1d1e246d
...@@ -1671,6 +1671,11 @@ The :exc:`~django.db.models.Model.DoesNotExist` exception inherits from ...@@ -1671,6 +1671,11 @@ The :exc:`~django.db.models.Model.DoesNotExist` exception inherits from
except ObjectDoesNotExist: except ObjectDoesNotExist:
print("Either the entry or blog doesn't exist.") 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()`` ``create()``
~~~~~~~~~~~~ ~~~~~~~~~~~~
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment