Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion django/contrib/postgres/fields/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@

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
from django.db.models.fields.mixins import CheckFieldDefaultMixin
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"]
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/postgres/fields/hstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]


Expand Down
2 changes: 1 addition & 1 deletion django/contrib/postgres/fields/ranges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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__ = [
Expand Down
3 changes: 1 addition & 2 deletions django/contrib/postgres/forms/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
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,
)
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 = {
Expand Down
3 changes: 1 addition & 2 deletions django/core/checks/compatibility/django_4_0.py
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
3 changes: 1 addition & 2 deletions django/core/checks/security/base.py
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
3 changes: 1 addition & 2 deletions django/core/checks/security/csrf.py
Original file line number Diff line number Diff line change
@@ -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 "
Expand Down
3 changes: 1 addition & 2 deletions django/core/checks/security/sessions.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
3 changes: 1 addition & 2 deletions django/core/management/commands/startproject.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
5 changes: 3 additions & 2 deletions docs/internals/contributing/writing-code/coding-style.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
20 changes: 9 additions & 11 deletions docs/internals/howto-release-django.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand All @@ -380,12 +384,6 @@ Feature freeze tasks
<https://github.com/pypa/trove-classifiers/pulls?q=is%3Apr+django+trove+classifier>`_.
For example ``Framework :: Django :: 5.2``.

#. Create a `roadmap page
<https://code.djangoproject.com/wiki/Version6.0Roadmap>`_ 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
<https://code.djangoproject.com/#Djangoreleaseprocess>`_ on Trac.
Expand Down
9 changes: 7 additions & 2 deletions docs/intro/tutorial02.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 </topics/i18n/timezones>`.

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

Expand Down
2 changes: 1 addition & 1 deletion tests/model_fields/test_foreignkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)