mirror of https://github.com/django/django.git
Fixed #26438 -- Fixed multiple .objects typos in the docs.
Thanks Pablo Oubiña for the report.
This commit is contained in:
parent
8928823b13
commit
64aba7a8ab
|
@ -132,9 +132,9 @@ Django quotes column and table names behind the scenes.
|
||||||
|
|
||||||
>>> bar = Bar.objects.get(pk=1)
|
>>> bar = Bar.objects.get(pk=1)
|
||||||
>>> # Using model name "bar" as lookup string is deprecated.
|
>>> # Using model name "bar" as lookup string is deprecated.
|
||||||
>>> Foo.object.get(bar=bar)
|
>>> Foo.objects.get(bar=bar)
|
||||||
>>> # You should use default_related_name "bars".
|
>>> # You should use default_related_name "bars".
|
||||||
>>> Foo.object.get(bars=bar)
|
>>> Foo.objects.get(bars=bar)
|
||||||
|
|
||||||
``get_latest_by``
|
``get_latest_by``
|
||||||
-----------------
|
-----------------
|
||||||
|
|
|
@ -804,11 +804,11 @@ lookup name is deprecated. For example, since ``default_related_name`` is set
|
||||||
in model ``Bar``, instead of using the model name ``bar`` as the lookup::
|
in model ``Bar``, instead of using the model name ``bar`` as the lookup::
|
||||||
|
|
||||||
>>> bar = Bar.objects.get(pk=1)
|
>>> bar = Bar.objects.get(pk=1)
|
||||||
>>> Foo.object.get(bar=bar)
|
>>> Foo.objects.get(bar=bar)
|
||||||
|
|
||||||
use the default_related_name ``bars``::
|
use the default_related_name ``bars``::
|
||||||
|
|
||||||
>>> Foo.object.get(bars=bar)
|
>>> Foo.objects.get(bars=bar)
|
||||||
|
|
||||||
.. _search-lookup-replacement:
|
.. _search-lookup-replacement:
|
||||||
|
|
||||||
|
|
|
@ -161,7 +161,7 @@ So using the :ref:`example Weblog models <queryset-model-example>`::
|
||||||
|
|
||||||
will be quicker than:
|
will be quicker than:
|
||||||
|
|
||||||
>>> entry = Entry.object.get(headline="News Item Title")
|
>>> entry = Entry.objects.get(headline="News Item Title")
|
||||||
|
|
||||||
because ``id`` is indexed by the database and is guaranteed to be unique.
|
because ``id`` is indexed by the database and is guaranteed to be unique.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue