From 9814676ea75bfe5c5d5244c50ccfe1f652a2f058 Mon Sep 17 00:00:00 2001 From: Clifford Gama Date: Sat, 17 Jan 2026 12:41:15 +0200 Subject: [6.0.x] Refs #25508 -- Updated outdated QuerySet.__repr__() results. Backport of d6cca8b904de144946453aea93dd627c09abfca9 from main. --- docs/ref/models/querysets.txt | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) (limited to 'docs/ref/models') 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() - [...] - + >>> Entry.objects.order_by("pub_date").distinct("pub_date") - [...] - + >>> Entry.objects.order_by("blog").distinct("blog") - [...] - + >>> Entry.objects.order_by("author", "pub_date").distinct("author", "pub_date") - [...] - + >>> Entry.objects.order_by("blog__name", "mod_date").distinct("blog__name", "mod_date") - [...] - + >>> Entry.objects.order_by("author", "pub_date").distinct("author") - [...] + .. 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)"... + , , ...]> 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 - [] + ]> >>> Question.objects.prefetch_related(prefetch).get().choice_set.all() , , ]> -- cgit v1.3