---
title: "Django 5.2 release notes"
version: 6.0
locale: zh-hans
source: https://docs.djangoproject.com/zh-hans/6.0/releases/5.2/
canonical: https://djangodocs.dev/zh-hans/6.0/releases/5.2/
---
# Django 5.2 release notes

*April 2, 2025*

Welcome to Django 5.2!

These release notes cover the [new features](#whats-new-5-2), as well as
some [backwards incompatible changes](#backwards-incompatible-5-2) you
should be aware of when upgrading from Django 5.1 or earlier. We've
[begun the deprecation process for some features](#deprecated-features-5-2).

如果你要更新现有的项目，请看 [如何将 Django 更新至新的版本](/zh-hans/6.0/howto/upgrade-version/) 指南。

Django 5.2 is designated as a [long-term support release](/zh-hans/6.0/internals/release-process/#term-Long-term-support-release). It will receive security updates for at least
three years after its release. Support for the previous LTS, Django 4.2, will
end in April 2026.

## Python 兼容性

Django 5.2 supports Python 3.10, 3.11, 3.12, 3.13, and 3.14 (as of 5.2.8). We
**highly recommend** and only officially support the latest release of each
series.

## What's new in Django 5.2

### Automatic models import in the `shell`

The [`shell`](/zh-hans/6.0/ref/django-admin/#django-admin-shell) management command now automatically imports models from
all installed apps. You can view further details of the imported objects by
setting the `--verbosity` flag to 2 or more:

```console
$ python -Wall manage.py shell --verbosity=2
6 objects imported automatically, including:

  from django.contrib.admin.models import LogEntry
  from django.contrib.auth.models import Group, Permission, User
  from django.contrib.contenttypes.models import ContentType
  from django.contrib.sessions.models import Session
```

*Windows*

```doscon
...\> py -Wall manage.py shell --verbosity=2
6 objects imported automatically, including:

  from django.contrib.admin.models import LogEntry
  from django.contrib.auth.models import Group, Permission, User
  from django.contrib.contenttypes.models import ContentType
  from django.contrib.sessions.models import Session
```

This [behavior can be customized](/zh-hans/6.0/howto/custom-shell/#customizing-shell-auto-imports) to add
or remove automatic imports.

### Composite Primary Keys

The new [`django.db.models.CompositePrimaryKey`](/zh-hans/6.0/ref/models/fields/#django.db.models.CompositePrimaryKey) allows tables to be
created with a primary key consisting of multiple fields.

To use a composite primary key, when defining a model set the `pk` attribute
to be a `CompositePrimaryKey`:

```
from django.db import models

class Release(models.Model):
    pk = models.CompositePrimaryKey("version", "name")
    version = models.IntegerField()
    name = models.CharField(max_length=20)
```

See [Composite primary keys](/zh-hans/6.0/topics/composite-primary-key/) for more details.

### Simplified override of [`BoundField`](/zh-hans/6.0/ref/forms/api/#django.forms.BoundField)

Prior to version 5.2, overriding [`Field.get_bound_field()`](/zh-hans/6.0/ref/forms/fields/#django.forms.Field.get_bound_field) was the only
option to use a custom [`BoundField`](/zh-hans/6.0/ref/forms/api/#django.forms.BoundField). Django now supports
specifying the following attributes to customize form rendering:

- [`BaseRenderer.bound_field_class`](/zh-hans/6.0/ref/forms/renderers/#django.forms.renderers.BaseRenderer.bound_field_class) at the project level,
- [`Form.bound_field_class`](/zh-hans/6.0/ref/forms/api/#django.forms.Form.bound_field_class) at the form level, and
- [`Field.bound_field_class`](/zh-hans/6.0/ref/forms/fields/#django.forms.Field.bound_field_class) at the field level.

For example, to customize the `BoundField` of a `Form` class:

```
from django import forms

class CustomBoundField(forms.BoundField):

    custom_class = "custom"

    def css_classes(self, extra_classes=None):
        result = super().css_classes(extra_classes)
        if self.custom_class not in result:
            result += f" {self.custom_class}"
        return result.strip()

class CustomForm(forms.Form):
    bound_field_class = CustomBoundField

    name = forms.CharField(
        label="Your Name",
        max_length=100,
        required=False,
        widget=forms.TextInput(attrs={"class": "name-input-class"}),
    )
    email = forms.EmailField(label="Your Email")
```

When rendering a `CustomForm` instance, the following HTML is included:

```html
<div class="custom">
  <label for="id_name">Your Name:</label>
  <input type="text" name="name" class="name-input-class" maxlength="100" id="id_name">
</div>

<div class="custom">
  <label for="id_email">Your Email:</label>
  <input type="email" name="email" maxlength="320" required="" id="id_email">
</div>
```

See [自定义 BoundField](/zh-hans/6.0/ref/forms/api/#custom-boundfield) for more details about this feature.

### 次要特性

#### [`django.contrib.admin`](/zh-hans/6.0/ref/contrib/admin/#module-django.contrib.admin)

- The `admin/base.html` template now has a new block
  [extrabody](/zh-hans/6.0/ref/contrib/admin/#extrabody) for adding custom code before the closing
  `</body>` tag.
- The value of a [`URLField`](/zh-hans/6.0/ref/models/fields/#django.db.models.URLField) now renders as a link.

#### [`django.contrib.admindocs`](/zh-hans/6.0/ref/contrib/admin/admindocs/#module-django.contrib.admindocs)

- Links to components in docstrings now supports custom link text, using the
  format `` :role:`link text <link>` ``. See [documentation helpers](/zh-hans/6.0/ref/contrib/admin/admindocs/#admindocs-helpers) for more details.
- The [model pages](/zh-hans/6.0/ref/contrib/admin/admindocs/#admindocs-model-reference) are now restricted to
  users with the corresponding view or change permissions.

#### [`django.contrib.auth`](/zh-hans/6.0/topics/auth/#module-django.contrib.auth)

- The default iteration count for the PBKDF2 password hasher is increased from
  870,000 to 1,000,000.
- The following new asynchronous methods are now provided, using an `a`
  prefix:

  - [`UserManager.acreate_user()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.UserManager.acreate_user)
  - [`UserManager.acreate_superuser()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.UserManager.acreate_superuser)
  - [`BaseUserManager.aget_by_natural_key()`](/zh-hans/6.0/topics/auth/customizing/#django.contrib.auth.models.BaseUserManager.aget_by_natural_key)
  - [`User.aget_user_permissions()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.User.aget_user_permissions)
  - [`User.aget_all_permissions()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.User.aget_all_permissions)
  - [`User.aget_group_permissions()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.User.aget_group_permissions)
  - [`User.ahas_perm()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.User.ahas_perm)
  - [`User.ahas_perms()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.User.ahas_perms)
  - [`User.ahas_module_perms()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.User.ahas_module_perms)
  - [`ModelBackend.aauthenticate()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend.aauthenticate)
  - [`ModelBackend.aget_user_permissions()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend.aget_user_permissions)
  - [`ModelBackend.aget_group_permissions()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend.aget_group_permissions)
  - [`ModelBackend.aget_all_permissions()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend.aget_all_permissions)
  - [`ModelBackend.ahas_perm()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend.ahas_perm)
  - [`ModelBackend.ahas_module_perms()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.ModelBackend.ahas_module_perms)
  - [`RemoteUserBackend.aauthenticate()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.RemoteUserBackend.aauthenticate)
  - [`RemoteUserBackend.aconfigure_user()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.backends.RemoteUserBackend.aconfigure_user)
- Auth backends can now provide async implementations which are used when
  calling async auth functions (e.g.
  [`aauthenticate()`](/zh-hans/6.0/topics/auth/default/#django.contrib.auth.aauthenticate)) to reduce context-switching
  which improves performance. See [adding an async interface](/zh-hans/6.0/topics/auth/customizing/#writing-authentication-backends-async-interface) for more details.
- The [password validator classes](/zh-hans/6.0/topics/auth/passwords/#included-password-validators)
  now have a new method `get_error_message()`, which can be overridden in
  subclasses to customize the error messages.

#### [`django.contrib.gis`](/zh-hans/6.0/ref/contrib/gis/#module-django.contrib.gis)

- GDAL now supports curved geometries `CurvePolygon`, `CompoundCurve`,
  `CircularString`, `MultiSurface`, and `MultiCurve` via the new
  [`OGRGeometry.has_curve`](/zh-hans/6.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.OGRGeometry.has_curve) property, and the
  [`OGRGeometry.get_linear_geometry()`](/zh-hans/6.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.OGRGeometry.get_linear_geometry) and
  [`OGRGeometry.get_curve_geometry()`](/zh-hans/6.0/ref/contrib/gis/gdal/#django.contrib.gis.gdal.OGRGeometry.get_curve_geometry) methods.
- [`coveredby`](/zh-hans/6.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-coveredby) and [`covers`](/zh-hans/6.0/ref/contrib/gis/geoquerysets/#std-fieldlookup-covers) lookup are now supported on MySQL.

#### [`django.contrib.syndication`](/zh-hans/6.0/ref/contrib/syndication/#module-django.contrib.syndication)

- All [`SyndicationFeed`](/zh-hans/6.0/ref/utils/#django.utils.feedgenerator.SyndicationFeed) classes now support
  a `stylesheets` attribute. If specified, an `<? xml-stylesheet ?>`
  processing instruction will be added to the top of the document for each
  stylesheet in the given list. See [Feed stylesheets](/zh-hans/6.0/ref/contrib/syndication/#feed-stylesheets) for more details.

#### 数据库后端

- MySQL connections now default to using the `utf8mb4` character set,
  instead of `utf8`, which is an alias for the deprecated character set
  `utf8mb3`.
- Oracle backends now support [connection pools](/zh-hans/6.0/ref/databases/#oracle-pool), by setting
  `"pool"` in the [`OPTIONS`](/zh-hans/6.0/ref/settings/#std-setting-OPTIONS) part of your database configuration.

#### 装饰器

- [`method_decorator()`](/zh-hans/6.0/ref/utils/#django.utils.decorators.method_decorator) now supports wrapping
  asynchronous view methods.

#### 电子邮件

- Tuple items of [`EmailMessage.attachments`](/zh-hans/6.0/topics/email/#django.core.mail.EmailMessage) and
  [`EmailMultiAlternatives.attachments`](/zh-hans/6.0/topics/email/#django.core.mail.EmailMultiAlternatives) are now named tuples, as opposed
  to regular tuples.
- [`EmailMultiAlternatives.alternatives`](/zh-hans/6.0/topics/email/#django.core.mail.EmailMultiAlternatives.alternatives) is now a list of
  named tuples, as opposed to regular tuples.
- The new [`body_contains()`](/zh-hans/6.0/topics/email/#django.core.mail.EmailMultiAlternatives.body_contains) method
  returns a boolean indicating whether a provided text is contained in the
  email `body` and in all attached MIME type `text/*` alternatives.

#### 错误报告

- The attribute [`SafeExceptionReporterFilter.hidden_settings`](/zh-hans/6.0/howto/error-reporting/#django.views.debug.SafeExceptionReporterFilter.hidden_settings) now
  treats values as sensitive if their name includes `AUTH`.

#### 表单

- The new [`ColorInput`](/zh-hans/6.0/ref/forms/widgets/#django.forms.ColorInput) form widget is for entering a color
  in `rrggbb` hexadecimal format and renders as `<input type="color" ...>`.
  Some browsers support a visual color picker interface for this input type.
- The new [`SearchInput`](/zh-hans/6.0/ref/forms/widgets/#django.forms.SearchInput) form widget is for entering search
  queries and renders as `<input type="search" ...>`.
- The new [`TelInput`](/zh-hans/6.0/ref/forms/widgets/#django.forms.TelInput) form widget is for entering telephone
  numbers and renders as `<input type="tel" ...>`.
- The new `field_id` argument for [`ErrorList`](/zh-hans/6.0/ref/forms/api/#django.forms.ErrorList) allows an
  HTML `id` attribute to be added in the error template. See
  [`ErrorList.field_id`](/zh-hans/6.0/ref/forms/api/#django.forms.ErrorList.field_id) for details.
- An [`aria_describedby`](/zh-hans/6.0/ref/forms/api/#django.forms.BoundField.aria_describedby) property is added to
  `BoundField` to ease use of this HTML attribute in templates.
- To improve accessibility for screen reader users `aria-describedby` is used
  to associate form fields with their error messages. See
  [how form errors are displayed](/zh-hans/6.0/ref/forms/api/#form-error-display) for details.
- The new asset object [`Script`](/zh-hans/6.0/topics/forms/media/#django.forms.Script) is available for adding
  custom HTML-attributes to JavaScript in form media. See
  [paths as objects](/zh-hans/6.0/topics/forms/media/#form-media-asset-objects) for more details.

#### 管理命令

- A new warning is displayed when running [`runserver`](/zh-hans/6.0/ref/django-admin/#django-admin-runserver), indicating that
  it is unsuitable for production. This warning can be suppressed by setting
  the [`DJANGO_RUNSERVER_HIDE_WARNING`](/zh-hans/6.0/ref/django-admin/#envvar-DJANGO_RUNSERVER_HIDE_WARNING) environment variable to
  `"true"`.
- The [`makemigrations`](/zh-hans/6.0/ref/django-admin/#django-admin-makemigrations) and [`migrate`](/zh-hans/6.0/ref/django-admin/#django-admin-migrate) commands  have a new
  `Command.autodetector` attribute for subclasses to override in order to use
  a custom autodetector class.
- The new [`BaseCommand.get_check_kwargs()`](/zh-hans/6.0/howto/custom-management-commands/#django.core.management.BaseCommand.get_check_kwargs) method can be overridden in
  custom commands to control the running of system checks, e.g. to opt into
  database-dependent checks.

#### 迁移

- The new operation [`AlterConstraint`](/zh-hans/6.0/ref/migration-operations/#django.db.migrations.operations.AlterConstraint) is a no-op operation that alters
  constraints without dropping and recreating constraints in the database.

#### 模型

- The `SELECT` clause generated when using [`QuerySet.values()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.values) and
  [`QuerySet.values_list()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.values_list) now matches the specified order of the
  referenced expressions. Previously, the order was based on a set of
  counterintuitive rules which made query combination through methods such as
  [`QuerySet.union()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.union) unpredictable.
- Added support for validation of model constraints which use a
  [`GeneratedField`](/zh-hans/6.0/ref/models/fields/#django.db.models.GeneratedField).
- The new [`Expression.set_returning`](/zh-hans/6.0/ref/models/expressions/#django.db.models.Expression.set_returning) attribute specifies that the
  expression contains a set-returning function, enforcing subquery evaluation.
  This is necessary for many Postgres set-returning functions.
- [`CharField.max_length`](/zh-hans/6.0/ref/models/fields/#django.db.models.CharField.max_length) is no
  longer required to be set on SQLite, which supports unlimited `VARCHAR`
  columns.
- [`QuerySet.explain()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.explain) now supports the `memory` and `serialize`
  options on PostgreSQL 17+.
- The new [`JSONArray`](/zh-hans/6.0/ref/models/database-functions/#django.db.models.functions.JSONArray) database function
  accepts a list of field names or expressions and returns a JSON array
  containing those values.
- The new [`Expression.allows_composite_expressions`](/zh-hans/6.0/ref/models/expressions/#django.db.models.Expression.allows_composite_expressions) attribute specifies
  that the expression allows composite expressions, for example, to support
  [composite primary keys](/zh-hans/6.0/topics/composite-primary-key/#cpk-and-database-functions).

#### 请求和响应

- The new [`HttpResponse.text`](/zh-hans/6.0/ref/request-response/#django.http.HttpResponse.text) property provides the string
  representation of [`HttpResponse.content`](/zh-hans/6.0/ref/request-response/#django.http.HttpResponse.content).
- The new [`HttpRequest.get_preferred_type()`](/zh-hans/6.0/ref/request-response/#django.http.HttpRequest.get_preferred_type) method can be used to query
  the preferred media type the client accepts.
- The new `preserve_request` argument for
  [`HttpResponseRedirect`](/zh-hans/6.0/ref/request-response/#django.http.HttpResponseRedirect) and
  [`HttpResponsePermanentRedirect`](/zh-hans/6.0/ref/request-response/#django.http.HttpResponsePermanentRedirect)
  determines whether the HTTP status codes 302/307 or 301/308 are used,
  respectively.
- The new `preserve_request` argument for
  [`redirect()`](/zh-hans/6.0/topics/http/shortcuts/#django.shortcuts.redirect) allows to instruct the user agent to reuse
  the HTTP method and body during redirection using specific status codes.

#### 序列化

- Each serialization format now defines a `Deserializer` class, rather than a
  function, to improve extensibility when defining a
  [custom serialization format](/zh-hans/6.0/topics/serialization/#custom-serialization-formats).

#### 模板

- The new [`simple_block_tag()`](/zh-hans/6.0/howto/custom-template-tags/#django.template.Library.simple_block_tag) decorator enables
  the creation of simple block tags, which can accept and use a section of the
  template.

#### 测试

- Stack frames from Django's custom assertions are now hidden. This makes test
  failures easier to read and enables [`test --pdb`](/zh-hans/6.0/ref/django-admin/#cmdoption-test-pdb) to directly enter
  into the failing test method.
- Data loaded from [`fixtures`](/zh-hans/6.0/topics/testing/tools/#django.test.TransactionTestCase.fixtures) and from
  migrations enabled with [serialized\_rollback=True](/zh-hans/6.0/topics/testing/overview/#test-case-serialized-rollback) are now available during
  `TransactionTestCase.setUpClass()`.

#### URLs

- [`reverse()`](/zh-hans/6.0/ref/urlresolvers/#django.urls.reverse) and [`reverse_lazy()`](/zh-hans/6.0/ref/urlresolvers/#django.urls.reverse_lazy) now accept
  `query` and `fragment` keyword arguments, allowing the addition of a
  query string and/or fragment identifier in the generated URL, respectively.

#### 实用程序

- [`SafeString`](/zh-hans/6.0/ref/utils/#django.utils.safestring.SafeString) now returns
  [`NotImplemented`](https://docs.python.org/3/library/constants.html#NotImplemented) in `__add__` for non-string right-hand side
  values. This aligns with the [`str`](https://docs.python.org/3/library/stdtypes.html#str) addition behavior and allows
  `__radd__` to be used if available.
- [`format_html_join()`](/zh-hans/6.0/ref/utils/#django.utils.html.format_html_join) now supports taking an iterable
  of mappings, passing their contents as keyword arguments to
  [`format_html()`](/zh-hans/6.0/ref/utils/#django.utils.html.format_html).

## Backwards incompatible changes in 5.2

### 数据库后端 API

本节介绍了第三方数据库后端可能需要的更改。

- The new [`Model._is_pk_set()`](/zh-hans/6.0/ref/models/instances/#django.db.models.Model._is_pk_set) method
  allows checking if a Model instance's primary key is defined.
- `BaseDatabaseOperations.adapt_decimalfield_value()` is now a no-op, simply
  returning the given value.

### [`django.contrib.gis`](/zh-hans/6.0/ref/contrib/gis/#module-django.contrib.gis)

- Support for PostGIS 3.0 is removed.
- Support for GDAL 3.0 is removed.

### Dropped support for PostgreSQL 13

Upstream support for PostgreSQL 13 ends in November 2025. Django 5.2 supports
PostgreSQL 14 and higher.

### Changed MySQL connection character set default

MySQL connections now default to using the `utf8mb4` character set, instead
of `utf8`, which is an alias for the deprecated character set `utf8mb3`.
`utf8mb3` can be specified in the `OPTIONS` part of the `DATABASES`
setting, if needed for legacy databases.

### 杂项

- Adding [`EmailMultiAlternatives.alternatives`](/zh-hans/6.0/topics/email/#django.core.mail.EmailMultiAlternatives.alternatives) is now only supported via
  the [`attach_alternative()`](/zh-hans/6.0/topics/email/#django.core.mail.EmailMultiAlternatives.attach_alternative) method.
- The minimum supported version of `gettext` is increased from 0.15 to 0.19.
- `HttpRequest.accepted_types` is now sorted by the client's preference,
  based on the request's `Accept` header.
- The attributes [`UniqueConstraint.violation_error_code`](/zh-hans/6.0/ref/models/constraints/#django.db.models.UniqueConstraint.violation_error_code) and
  [`UniqueConstraint.violation_error_message`](/zh-hans/6.0/ref/models/constraints/#django.db.models.UniqueConstraint.violation_error_message) are now always used when
  provided. Previously, they were ignored if [`UniqueConstraint.fields`](/zh-hans/6.0/ref/models/constraints/#django.db.models.UniqueConstraint.fields)
  was set without a [`UniqueConstraint.condition`](/zh-hans/6.0/ref/models/constraints/#django.db.models.UniqueConstraint.condition).
- The [`debug()`](/zh-hans/6.0/ref/templates/api/#django.template.context_processors.debug) context processor is no
  longer included in the default project template.
- The following methods now have `alters_data=True` set to prevent side
  effects when [rendering a template context](/zh-hans/6.0/ref/templates/api/#alters-data-description):

  - [`UserManager.create_user()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.UserManager.create_user)
  - [`UserManager.acreate_user()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.UserManager.acreate_user)
  - [`UserManager.create_superuser()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.UserManager.create_superuser)
  - [`UserManager.acreate_superuser()`](/zh-hans/6.0/ref/contrib/auth/#django.contrib.auth.models.UserManager.acreate_superuser)
  - [`QuerySet.create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.create)
  - [`QuerySet.acreate()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.acreate)
  - [`QuerySet.bulk_create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.bulk_create)
  - [`QuerySet.abulk_create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.abulk_create)
  - [`QuerySet.get_or_create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.get_or_create)
  - [`QuerySet.aget_or_create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.aget_or_create)
  - [`QuerySet.update_or_create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.update_or_create)
  - [`QuerySet.aupdate_or_create()`](/zh-hans/6.0/ref/models/querysets/#django.db.models.query.QuerySet.aupdate_or_create)
- The minimum supported version of `oracledb` is increased from 1.3.2 to
  2.3.0.
- Built-in aggregate functions accepting only one argument (`Avg`, `Count`,
  `Max`, `Min`, `StdDev`, `Sum`, and `Variance`) now raise
  [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) when called with an incorrect number of arguments.

## Features deprecated in 5.2

### 杂项

- The `all` argument for the `django.contrib.staticfiles.finders.find()`
  function is deprecated in favor of the `find_all` argument.
- Fallbacks to `request.user` and `request.auser()` when `user` is
  `None` in `django.contrib.auth.login()` and
  `django.contrib.auth.alogin()`, respectively, are deprecated.
- The `ordering` keyword argument of the PostgreSQL specific aggregation
  functions `django.contrib.postgres.aggregates.ArrayAgg`,
  `django.contrib.postgres.aggregates.JSONBAgg`, and
  `django.contrib.postgres.aggregates.StringAgg` is deprecated in favor
  of the `order_by` argument.
- Support for subclasses of `RemoteUserMiddleware` that override
  `process_request()` without overriding `aprocess_request()` is
  deprecated.
