diff options
| author | Clifford Gama <cliffygamy@gmail.com> | 2026-01-17 12:41:15 +0200 |
|---|---|---|
| committer | Jacob Walls <jacobtylerwalls@gmail.com> | 2026-01-19 09:59:17 -0500 |
| commit | 9814676ea75bfe5c5d5244c50ccfe1f652a2f058 (patch) | |
| tree | fb92df0f7c064888751519d5a2784075f8156e30 | |
| parent | 3d9f04289bb82e4a4f74b1f2139a06e1a6e8a5b2 (diff) | |
[6.0.x] Refs #25508 -- Updated outdated QuerySet.__repr__() results.
Backport of d6cca8b904de144946453aea93dd627c09abfca9 from main.
| -rw-r--r-- | docs/ref/contrib/postgres/lookups.txt | 8 | ||||
| -rw-r--r-- | docs/ref/models/querysets.txt | 21 |
2 files changed, 12 insertions, 17 deletions
diff --git a/docs/ref/contrib/postgres/lookups.txt b/docs/ref/contrib/postgres/lookups.txt index 6dc6618f9a..5f59e8c7f8 100644 --- a/docs/ref/contrib/postgres/lookups.txt +++ b/docs/ref/contrib/postgres/lookups.txt @@ -28,7 +28,7 @@ The ``trigram_similar`` lookup can be used on .. code-block:: pycon >>> City.objects.filter(name__trigram_similar="Middlesborough") - ['<City: Middlesbrough>'] + <QuerySet [<City: Middlesbrough>]> .. fieldlookup:: trigram_word_similar @@ -54,7 +54,7 @@ The ``trigram_word_similar`` lookup can be used on .. code-block:: pycon >>> Sentence.objects.filter(name__trigram_word_similar="Middlesborough") - ['<Sentence: Gumby rides on the path of Middlesbrough>'] + <QuerySet [<Sentence: Gumby rides on the path of Middlesbrough>]> .. fieldlookup:: trigram_strict_word_similar @@ -99,10 +99,10 @@ The ``unaccent`` lookup can be used on .. code-block:: pycon >>> City.objects.filter(name__unaccent="México") - ['<City: Mexico>'] + <QuerySet [<City: Mexico>]> >>> User.objects.filter(first_name__unaccent__startswith="Jerem") - ['<User: Jeremy>', '<User: Jérémy>', '<User: Jérémie>', '<User: Jeremie>'] + <QuerySet [<User: Jeremy>, <User: Jérémy>, <User: Jérémie>, <User: Jeremie>]> .. warning:: diff --git a/docs/ref/models/querysets.txt b/docs/ref/models/querysets.txt index ddeb9ab45b..2e60c6e9f2 100644 --- a/docs/ref/models/querysets.txt +++ b/docs/ref/models/querysets.txt @@ -549,22 +549,17 @@ Examples (those after the first will only work on PostgreSQL): .. code-block:: pycon >>> Author.objects.distinct() - [...] - + <QuerySet [...]> >>> Entry.objects.order_by("pub_date").distinct("pub_date") - [...] - + <QuerySet [...]> >>> Entry.objects.order_by("blog").distinct("blog") - [...] - + <QuerySet [...]> >>> Entry.objects.order_by("author", "pub_date").distinct("author", "pub_date") - [...] - + <QuerySet [...]> >>> Entry.objects.order_by("blog__name", "mod_date").distinct("blog__name", "mod_date") - [...] - + <QuerySet [...]> >>> Entry.objects.order_by("author", "pub_date").distinct("author") - [...] + <QuerySet [...]> .. note:: Keep in mind that :meth:`order_by` uses any default related model ordering @@ -1200,7 +1195,7 @@ and run: .. code-block:: pycon >>> Pizza.objects.all() - ["Hawaiian (ham, pineapple)", "Seafood (prawns, smoked salmon)"... + <QuerySet [<Pizza: Hawaiian (ham, pineapple)>, <Pizza: Seafood (prawns, smoked salmon)>, ...]> The problem with this is that every time ``Pizza.__str__()`` asks for ``self.toppings.all()`` it has to query the database, so @@ -4215,7 +4210,7 @@ attribute: >>> prefetch = Prefetch("choice_set", queryset=voted_choices, to_attr="voted_choices") >>> Question.objects.prefetch_related(prefetch).get().voted_choices - [<Choice: The sky>] + <QuerySet [<Choice: The sky>]> >>> Question.objects.prefetch_related(prefetch).get().choice_set.all() <QuerySet [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]> |
