Skip to content

Commit 4ded711

Browse files
committed
Merge remote-tracking branch 'upstream/main'
2 parents f7935fd + 59fcd2a commit 4ded711

File tree

16 files changed

+32
-35
lines changed

16 files changed

+32
-35
lines changed

.git-blame-ignore-revs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ f81e6e3a53ee36e3f730a71aa55a5744982dd016
1515
b1e33ceceda1e75ff68c7deed8f6659683a195d3
1616
c9178ef17a0e1070f5a25096d8e13385d404dc92
1717
1101467ce0756272a54f4c7bc65c4c335a94111b
18+
6cff02078799b7c683a0d39630d49ab4fe532e7c

django/db/migrations/graph.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from functools import total_ordering
22

33
from django.db.migrations.state import ProjectState
4+
from django.utils.datastructures import OrderedSet
45

56
from .exceptions import CircularDependencyError, NodeNotFoundError
67

@@ -305,12 +306,12 @@ def _nodes_and_edges(self):
305306
)
306307

307308
def _generate_plan(self, nodes, at_end):
308-
plan = []
309+
plan = OrderedSet()
309310
for node in nodes:
310311
for migration in self.forwards_plan(node):
311312
if migration not in plan and (at_end or migration not in nodes):
312-
plan.append(migration)
313-
return plan
313+
plan.add(migration)
314+
return list(plan)
314315

315316
def make_state(self, nodes=None, at_end=True, real_apps=None):
316317
"""

docs/internals/contributing/writing-documentation.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,7 @@ define some extra description units:
520520

521521
Django's documentation uses a custom ``console`` directive for documenting
522522
command-line examples involving ``django-admin``, ``manage.py``, ``python``,
523-
etc.). In the HTML documentation, it renders a two-tab UI, with one tab showing
523+
etc. In the HTML documentation, it renders a two-tab UI, with one tab showing
524524
a Unix-style command prompt and a second tab showing a Windows prompt.
525525

526526
For example, you can replace this fragment:
@@ -584,7 +584,7 @@ blank line and an optional description (indented).
584584

585585
General improvements or other changes to the APIs that should be emphasized
586586
should use the "``.. versionchanged:: X.Y``" directive (with the same format
587-
as the ``versionadded`` mentioned above.
587+
as the ``versionadded`` mentioned above).
588588

589589
These ``versionadded`` and ``versionchanged`` blocks should be
590590
"self-contained." In other words, since we only keep these annotations around

docs/ref/contrib/postgres/lookups.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The ``trigram_similar`` lookup can be used on
2828
.. code-block:: pycon
2929

3030
>>> City.objects.filter(name__trigram_similar="Middlesborough")
31-
['<City: Middlesbrough>']
31+
<QuerySet [<City: Middlesbrough>]>
3232

3333
.. fieldlookup:: trigram_word_similar
3434

@@ -54,7 +54,7 @@ The ``trigram_word_similar`` lookup can be used on
5454
.. code-block:: pycon
5555

5656
>>> Sentence.objects.filter(name__trigram_word_similar="Middlesborough")
57-
['<Sentence: Gumby rides on the path of Middlesbrough>']
57+
<QuerySet [<Sentence: Gumby rides on the path of Middlesbrough>]>
5858

5959
.. fieldlookup:: trigram_strict_word_similar
6060

@@ -89,7 +89,7 @@ can be chained with other lookup functions. To use it, you need to add
8989
the `unaccent extension on PostgreSQL`_. The
9090
:class:`~django.contrib.postgres.operations.UnaccentExtension` migration
9191
operation is available if you want to perform this activation using
92-
migrations).
92+
migrations.
9393

9494
.. _unaccent extension on PostgreSQL: https://www.postgresql.org/docs/current/unaccent.html
9595

@@ -99,10 +99,10 @@ The ``unaccent`` lookup can be used on
9999
.. code-block:: pycon
100100

101101
>>> City.objects.filter(name__unaccent="México")
102-
['<City: Mexico>']
102+
<QuerySet [<City: Mexico>]>
103103

104104
>>> User.objects.filter(first_name__unaccent__startswith="Jerem")
105-
['<User: Jeremy>', '<User: Jérémy>', '<User: Jérémie>', '<User: Jeremie>']
105+
<QuerySet [<User: Jeremy>, <User: Jérémy>, <User: Jérémie>, <User: Jeremie>]>
106106

107107
.. warning::
108108

docs/ref/migration-operations.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Alters the managers that are available during migrations.
158158
Adds a field to a model. ``model_name`` is the model's name, ``name`` is
159159
the field's name, and ``field`` is an unbound Field instance (the thing
160160
you would put in the field declaration in ``models.py`` - for example,
161-
``models.IntegerField(null=True)``.
161+
``models.IntegerField(null=True)``).
162162

163163
The ``preserve_default`` argument indicates whether the field's default
164164
value is permanent and should be baked into the project state (``True``),

docs/ref/models/instances.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,7 @@ The ``__hash__()`` method is based on the instance's primary key value. It
814814
is effectively ``hash(obj.pk)``. If the instance doesn't have a primary key
815815
value then a ``TypeError`` will be raised (otherwise the ``__hash__()``
816816
method would return different values before and after the instance is
817-
saved, but changing the :meth:`~object.__hash__` value of an instance is
817+
saved), but changing the :meth:`~object.__hash__` value of an instance is
818818
forbidden in Python.
819819

820820
``get_absolute_url()``

docs/ref/models/lookups.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ all Django builtin lookups are derived:
2626

2727
A lookup expression consists of three parts:
2828

29-
* Fields part (e.g.
29+
* Fields part, e.g.
3030
``Book.objects.filter(author__best_friends__first_name...``);
3131
* Transforms part (may be omitted) (e.g. ``__lower__first3chars__reversed``);
3232
* A lookup (e.g. ``__icontains``) that, if omitted, defaults to ``__exact``.

docs/ref/models/querysets.txt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -549,22 +549,17 @@ Examples (those after the first will only work on PostgreSQL):
549549
.. code-block:: pycon
550550

551551
>>> Author.objects.distinct()
552-
[...]
553-
552+
<QuerySet [...]>
554553
>>> Entry.objects.order_by("pub_date").distinct("pub_date")
555-
[...]
556-
554+
<QuerySet [...]>
557555
>>> Entry.objects.order_by("blog").distinct("blog")
558-
[...]
559-
556+
<QuerySet [...]>
560557
>>> Entry.objects.order_by("author", "pub_date").distinct("author", "pub_date")
561-
[...]
562-
558+
<QuerySet [...]>
563559
>>> Entry.objects.order_by("blog__name", "mod_date").distinct("blog__name", "mod_date")
564-
[...]
565-
560+
<QuerySet [...]>
566561
>>> Entry.objects.order_by("author", "pub_date").distinct("author")
567-
[...]
562+
<QuerySet [...]>
568563

569564
.. note::
570565
Keep in mind that :meth:`order_by` uses any default related model ordering
@@ -1204,7 +1199,7 @@ and run:
12041199
.. code-block:: pycon
12051200

12061201
>>> Pizza.objects.all()
1207-
["Hawaiian (ham, pineapple)", "Seafood (prawns, smoked salmon)"...
1202+
<QuerySet [<Pizza: Hawaiian (ham, pineapple)>, <Pizza: Seafood (prawns, smoked salmon)>, ...]>
12081203

12091204
The problem with this is that every time ``Pizza.__str__()`` asks for
12101205
``self.toppings.all()`` it has to query the database, so
@@ -1990,7 +1985,7 @@ them:
19901985
.. code-block:: pycon
19911986

19921987
>>> Person.objects.select_related("hometown").select_for_update().exclude(hometown=None)
1993-
<QuerySet [<Person: ...)>, ...]>
1988+
<QuerySet [<Person: ...>, ...]>
19941989

19951990
The ``postgresql``, ``oracle``, and ``mysql`` database backends support
19961991
``select_for_update()``. However, MariaDB only supports the ``nowait``
@@ -4240,7 +4235,7 @@ attribute:
42404235

42414236
>>> prefetch = Prefetch("choice_set", queryset=voted_choices, to_attr="voted_choices")
42424237
>>> Question.objects.prefetch_related(prefetch).get().voted_choices
4243-
[<Choice: The sky>]
4238+
<QuerySet [<Choice: The sky>]>
42444239
>>> Question.objects.prefetch_related(prefetch).get().choice_set.all()
42454240
<QuerySet [<Choice: Not much>, <Choice: The sky>, <Choice: Just hacking again>]>
42464241

docs/ref/request-response.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ All attributes should be considered read-only, unless stated otherwise.
186186
.. code-block:: pycon
187187

188188
>>> request.headers
189-
{'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6', ...}
189+
{'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6', ...)}
190190

191191
>>> "User-Agent" in request.headers
192192
True

docs/ref/settings.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3668,7 +3668,7 @@ usage.
36683668
:doc:`staticfiles</ref/contrib/staticfiles>`’s
36693669
:setting:`finders<STATICFILES_FINDERS>`, which by default, are
36703670
``'static/'`` app sub-directories and any directories you include in
3671-
:setting:`STATICFILES_DIRS`).
3671+
:setting:`STATICFILES_DIRS`.
36723672

36733673
.. setting:: STATIC_URL
36743674

0 commit comments

Comments
 (0)