From 1ae8a42af1ed75fbddfd12ad88781b3f0a8e86ed Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Mon, 13 Oct 2025 15:50:06 -0400 Subject: [PATCH 1/5] Removed reference to "manager" in ForeignKeyTests. Follow-up to 0de89b6f8d4d8f5fd232d6c5412260b0d79a760a. --- tests/model_fields/test_foreignkey.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/model_fields/test_foreignkey.py b/tests/model_fields/test_foreignkey.py index ca8eff354078..a662a6a1bfdf 100644 --- a/tests/model_fields/test_foreignkey.py +++ b/tests/model_fields/test_foreignkey.py @@ -165,5 +165,5 @@ def test_invalid_to_parameter(self): class MyModel(models.Model): child = models.ForeignKey(1, models.CASCADE) - def test_manager_class_getitem(self): + def test_class_getitem(self): self.assertIs(models.ForeignKey["Foo"], models.ForeignKey) From 92d0c21e69901cb7b749040670d3e6611353e1fa Mon Sep 17 00:00:00 2001 From: arsalan64 <68010697+arsalan64@users.noreply.github.com> Date: Sat, 27 Sep 2025 16:13:13 +0200 Subject: [PATCH 2/5] Fixed #36625 -- Mentioned exit() in tutorial's instruction to restart the shell. --- docs/intro/tutorial02.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/intro/tutorial02.txt b/docs/intro/tutorial02.txt index af9f717225c3..23bf6c4c94dc 100644 --- a/docs/intro/tutorial02.txt +++ b/docs/intro/tutorial02.txt @@ -441,8 +441,13 @@ time-zone-related utilities in :mod:`django.utils.timezone`, respectively. If you aren't familiar with time zone handling in Python, you can learn more in the :doc:`time zone support docs `. -Save these changes and start a new Python interactive shell by running -``python manage.py shell`` again: +Save these changes and start a new Python interactive shell. (If a +three-chevron prompt (>>>) indicates you are still in the shell, you need to +exit first using ``exit()``). Run ``python manage.py shell`` again to reload +the models. + +.. RemovedInDjango70Warning: When Python 3.12 is no longer supported, + ``exit()`` can be replaced with ``exit``. .. code-block:: pycon From d5543a23d32d6438edae060081a054f617193341 Mon Sep 17 00:00:00 2001 From: Natalia <124304+nessita@users.noreply.github.com> Date: Mon, 13 Oct 2025 13:37:26 -0300 Subject: [PATCH 3/5] Added notes about automatic roadmap generation for next version in docs/internals/howto-release-django.txt. --- docs/internals/howto-release-django.txt | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/docs/internals/howto-release-django.txt b/docs/internals/howto-release-django.txt index f6d2c1aff8ea..a76651934a17 100644 --- a/docs/internals/howto-release-django.txt +++ b/docs/internals/howto-release-django.txt @@ -355,11 +355,15 @@ Feature freeze tasks ``django_next_version`` to ``'6.0'`` on the new stable branch (:commit:`example commit <1eb62e5b622ef7fd6e0123d8bbf6662d893d5d08>`). -#. Go to the `Add release page in the admin`__, create a ``Release`` object for - the *final* release, ensuring that the *is active* field is unset, thus - marking it as *unreleased*. For example, when creating ``stable/5.2.x``, - create ``5.2`` with the active field unset. If the release is part of - an LTS branch, mark it so. +#. Create ``Release`` entries for the next version in the `admin`__ on + ``djangoproject.com``. Add one for each milestone (alpha, beta, rc, and + final), leaving *is active* unset to mark them as unreleased. Set target + dates per the agreed schedule, and set the LTS flag if applicable. The + ``X.Y`` roadmap page will be available at ``/download/X.Y/roadmap/``. + + For example, when creating ``stable/5.2.x``, add ``Release`` entries for + ``6.0a1``, ``6.0b1``, ``6.0rc1``, and ``6.0``. The ``6.0`` roadmap can be + then reviewed at https://www.djangoproject.com/download/6.0/roadmap/. __ https://www.djangoproject.com/admin/releases/release/add/ @@ -380,12 +384,6 @@ Feature freeze tasks `_. For example ``Framework :: Django :: 5.2``. -#. Create a `roadmap page - `_ for the next - release on Trac. To create a new page on the Wiki, navigate to the URL of - where you wish to create the page and a "Create this page" button will be - available. - #. Update the current branch under active development and add pre-release branch in the `Django release process `_ on Trac. From 54cfb5f328177b6fbf4eae827fbcbd757185dc85 Mon Sep 17 00:00:00 2001 From: lyova24 Date: Tue, 5 Aug 2025 18:14:25 +0700 Subject: [PATCH 4/5] Replaced multi-level relative imports with absolute imports in django/. --- django/contrib/postgres/fields/array.py | 5 ++++- django/contrib/postgres/fields/hstore.py | 3 +-- django/contrib/postgres/fields/ranges.py | 2 +- django/contrib/postgres/forms/array.py | 3 +-- django/core/checks/compatibility/django_4_0.py | 3 +-- django/core/checks/security/base.py | 3 +-- django/core/checks/security/csrf.py | 3 +-- django/core/checks/security/sessions.py | 3 +-- django/core/management/commands/startproject.py | 3 +-- 9 files changed, 12 insertions(+), 16 deletions(-) diff --git a/django/contrib/postgres/fields/array.py b/django/contrib/postgres/fields/array.py index ac663830f851..078428416c5a 100644 --- a/django/contrib/postgres/fields/array.py +++ b/django/contrib/postgres/fields/array.py @@ -2,6 +2,10 @@ from django.contrib.postgres import lookups from django.contrib.postgres.forms import SimpleArrayField +from django.contrib.postgres.utils import ( + CheckPostgresInstalledMixin, + prefix_validation_error, +) from django.contrib.postgres.validators import ArrayMaxLengthValidator from django.core import checks, exceptions from django.db.models import Field, Func, IntegerField, Transform, Value @@ -9,7 +13,6 @@ from django.db.models.lookups import Exact, In from django.utils.translation import gettext_lazy as _ -from ..utils import CheckPostgresInstalledMixin, prefix_validation_error from .utils import AttributeSetter __all__ = ["ArrayField"] diff --git a/django/contrib/postgres/fields/hstore.py b/django/contrib/postgres/fields/hstore.py index e28b9f7dbe3e..48a2e2603d59 100644 --- a/django/contrib/postgres/fields/hstore.py +++ b/django/contrib/postgres/fields/hstore.py @@ -2,13 +2,12 @@ from django.contrib.postgres import forms, lookups from django.contrib.postgres.fields.array import ArrayField +from django.contrib.postgres.utils import CheckPostgresInstalledMixin from django.core import exceptions from django.db.models import Field, TextField, Transform from django.db.models.fields.mixins import CheckFieldDefaultMixin from django.utils.translation import gettext_lazy as _ -from ..utils import CheckPostgresInstalledMixin - __all__ = ["HStoreField"] diff --git a/django/contrib/postgres/fields/ranges.py b/django/contrib/postgres/fields/ranges.py index 8c3295244b6b..33c6611f8672 100644 --- a/django/contrib/postgres/fields/ranges.py +++ b/django/contrib/postgres/fields/ranges.py @@ -2,6 +2,7 @@ import json from django.contrib.postgres import forms, lookups +from django.contrib.postgres.utils import CheckPostgresInstalledMixin from django.db import models from django.db.backends.postgresql.psycopg_any import ( DateRange, @@ -12,7 +13,6 @@ from django.db.models.functions import Cast from django.db.models.lookups import PostgresOperatorLookup -from ..utils import CheckPostgresInstalledMixin from .utils import AttributeSetter __all__ = [ diff --git a/django/contrib/postgres/forms/array.py b/django/contrib/postgres/forms/array.py index fd5cd219f85d..ae0c0c462bde 100644 --- a/django/contrib/postgres/forms/array.py +++ b/django/contrib/postgres/forms/array.py @@ -2,6 +2,7 @@ from itertools import chain from django import forms +from django.contrib.postgres.utils import prefix_validation_error from django.contrib.postgres.validators import ( ArrayMaxLengthValidator, ArrayMinLengthValidator, @@ -9,8 +10,6 @@ from django.core.exceptions import ValidationError from django.utils.translation import gettext_lazy as _ -from ..utils import prefix_validation_error - class SimpleArrayField(forms.CharField): default_error_messages = { diff --git a/django/core/checks/compatibility/django_4_0.py b/django/core/checks/compatibility/django_4_0.py index 79ee5fa6b3f7..dd741b528ca1 100644 --- a/django/core/checks/compatibility/django_4_0.py +++ b/django/core/checks/compatibility/django_4_0.py @@ -1,6 +1,5 @@ from django.conf import settings - -from .. import Error, Tags, register +from django.core.checks import Error, Tags, register @register(Tags.compatibility) diff --git a/django/core/checks/security/base.py b/django/core/checks/security/base.py index 7d9631df1e13..51f6df7a3bd1 100644 --- a/django/core/checks/security/base.py +++ b/django/core/checks/security/base.py @@ -1,8 +1,7 @@ from django.conf import settings +from django.core.checks import Error, Tags, Warning, register from django.core.exceptions import ImproperlyConfigured -from .. import Error, Tags, Warning, register - CROSS_ORIGIN_OPENER_POLICY_VALUES = { "same-origin", "same-origin-allow-popups", diff --git a/django/core/checks/security/csrf.py b/django/core/checks/security/csrf.py index d00f2259c67a..dee29384eeea 100644 --- a/django/core/checks/security/csrf.py +++ b/django/core/checks/security/csrf.py @@ -1,8 +1,7 @@ import inspect from django.conf import settings - -from .. import Error, Tags, Warning, register +from django.core.checks import Error, Tags, Warning, register W003 = Warning( "You don't appear to be using Django's built-in " diff --git a/django/core/checks/security/sessions.py b/django/core/checks/security/sessions.py index f317d09f731d..e529c2bc95f8 100644 --- a/django/core/checks/security/sessions.py +++ b/django/core/checks/security/sessions.py @@ -1,6 +1,5 @@ from django.conf import settings - -from .. import Tags, Warning, register +from django.core.checks import Tags, Warning, register def add_session_cookie_message(message): diff --git a/django/core/management/commands/startproject.py b/django/core/management/commands/startproject.py index ca17fa54cd6e..2b4f953e366f 100644 --- a/django/core/management/commands/startproject.py +++ b/django/core/management/commands/startproject.py @@ -1,7 +1,6 @@ from django.core.checks.security.base import SECRET_KEY_INSECURE_PREFIX from django.core.management.templates import TemplateCommand - -from ..utils import get_random_secret_key +from django.core.management.utils import get_random_secret_key class Command(TemplateCommand): From a545eb0c1ad5dcbb4e4cf22ce6cf486224c0ba8a Mon Sep 17 00:00:00 2001 From: lyova24 Date: Sun, 5 Oct 2025 04:28:46 +0700 Subject: [PATCH 5/5] Cautioned against multi-level relative imports in coding style docs. --- docs/internals/contributing/writing-code/coding-style.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/internals/contributing/writing-code/coding-style.txt b/docs/internals/contributing/writing-code/coding-style.txt index e016543ac62f..72429492cdb0 100644 --- a/docs/internals/contributing/writing-code/coding-style.txt +++ b/docs/internals/contributing/writing-code/coding-style.txt @@ -150,8 +150,9 @@ Imports other Django components, local Django component, try/excepts. Sort lines in each group alphabetically by the full module name. Place all ``import module`` statements before ``from module import objects`` in each - section. Use absolute imports for other Django components and relative - imports for local components. + section. Use absolute imports for other Django components and a one-dot + relative import (``from .foo import Bar``) for local components. Avoid + multi-dot relative imports. * On each line, alphabetize the items with the upper case items grouped before the lowercase items.