mirror of
https://github.com/django/django.git
synced 2025-11-19 11:15:44 +00:00
Fixed #36564 -- Changed DEFAULT_AUTO_FIELD from AutoField to BigAutoField.
Some checks failed
Docs / spelling (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Docs / lint-docs (push) Waiting to run
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
Some checks failed
Docs / spelling (push) Waiting to run
Docs / blacken-docs (push) Waiting to run
Docs / lint-docs (push) Waiting to run
Linters / flake8 (push) Has been cancelled
Linters / isort (push) Has been cancelled
Linters / black (push) Has been cancelled
Tests / Windows, SQLite, Python 3.13 (push) Has been cancelled
Tests / JavaScript tests (push) Has been cancelled
This commit is contained in:
parent
0ddbe12ea9
commit
2a636118da
26 changed files with 114 additions and 252 deletions
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
------------------------------------------------------
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue