summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2025-08-19 15:08:43 -0400
committerJacob Walls <jacobtylerwalls@gmail.com>2025-09-05 10:43:10 -0400
commit2a636118dacdcda074c99ebd50311d64a8cca367 (patch)
treef5b11c60f9fd598429d6ab60b35515a6c6d82256 /docs
parent0ddbe12ea99a2dc1b757dc2015ba8bb6bfd9d653 (diff)
Fixed #36564 -- Changed DEFAULT_AUTO_FIELD from AutoField to BigAutoField.
Diffstat (limited to 'docs')
-rw-r--r--docs/intro/reusable-apps.txt1
-rw-r--r--docs/ref/checks.txt3
-rw-r--r--docs/ref/settings.txt7
-rw-r--r--docs/releases/6.0.txt30
4 files changed, 38 insertions, 3 deletions
diff --git a/docs/intro/reusable-apps.txt b/docs/intro/reusable-apps.txt
index 723f752cc5..6c953a4043 100644
--- a/docs/intro/reusable-apps.txt
+++ b/docs/intro/reusable-apps.txt
@@ -153,7 +153,6 @@ this. For a small app like polls, this process isn't too difficult.
class PollsConfig(AppConfig):
- default_auto_field = "django.db.models.BigAutoField"
name = "django_polls"
label = "polls"
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index 36e6fe1d85..e1ea5bc753 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -429,7 +429,8 @@ Models
* **models.E042**: ``<field name>`` cannot be included in the composite
primary key.
* **models.W042**: Auto-created primary key used when not defining a primary
- key type, by default ``django.db.models.AutoField``.
+ key type, by default ``django.db.models.AutoField``. *This check appeared in
+ Django 3.2 - 5.2*.
* **models.W043**: ``<database>`` does not support indexes on expressions.
* **models.W044**: ``<database>`` does not support unique constraints on
expressions.
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index d5b7f2ad05..33e16695d2 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1279,11 +1279,16 @@ See also :setting:`NUMBER_GROUPING`, :setting:`THOUSAND_SEPARATOR` and
``DEFAULT_AUTO_FIELD``
----------------------
-Default: ``'``:class:`django.db.models.AutoField`\ ``'``
+Default: ``'``:class:`django.db.models.BigAutoField`\ ``'``
Default primary key field type to use for models that don't have a field with
:attr:`primary_key=True <django.db.models.Field.primary_key>`.
+.. versionchanged:: 6.0
+
+ In older versions, the default value is
+ :class:`django.db.models.AutoField`.
+
.. admonition:: Migrating auto-created through tables
The value of ``DEFAULT_AUTO_FIELD`` will be respected when creating new
diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt
index efc8a5bf41..6ba28b464d 100644
--- a/docs/releases/6.0.txt
+++ b/docs/releases/6.0.txt
@@ -458,6 +458,36 @@ Email
significantly, closely examine any custom subclasses that rely on overriding
undocumented, internal underscore methods.
+``DEFAULT_AUTO_FIELD`` setting now defaults to ``BigAutoField``
+---------------------------------------------------------------
+
+Since Django 3.2 when the :setting:`DEFAULT_AUTO_FIELD` setting was added,
+the default :djadmin:`startproject` template's ``settings.py`` contained::
+
+ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
+
+and the default :djadmin:`startapp` template's ``AppConfig`` contained::
+
+ default_auto_field = "django.db.models.BigAutoField"
+
+At that time, the default value of :setting:`DEFAULT_AUTO_FIELD` remained
+:class:`django.db.models.AutoField` for backwards compatibility.
+
+In Django 6.0, :setting:`DEFAULT_AUTO_FIELD` now defaults to
+:class:`django.db.models.BigAutoField` and the aforementioned lines in the
+project and app templates are removed.
+
+Most projects shouldn't be affected since there has been a system check warning
+since Django 3.2 if a project doesn't set :setting:`DEFAULT_AUTO_FIELD`:
+
+ **models.W042**: Auto-created primary key used when not defining a primary
+ key type, by default ``django.db.models.AutoField``.
+
+If you haven't dealt with this warning by now, add
+``DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'`` to your project's
+settings, or ``default_auto_field = 'django.db.models.AutoField'`` to an app's
+``AppConfig``, as needed.
+
Custom ORM expressions should return params as a tuple
------------------------------------------------------