[Django] #36564: Change DEFAULT_AUTO_FIELD to BigAutoField

5 views
Skip to first unread message

Django

unread,
Aug 20, 2025, 6:29:17 PMAug 20
to django-...@googlegroups.com
#36564: Change DEFAULT_AUTO_FIELD to BigAutoField
-------------------------------------+-------------------------------------
Reporter: Tim | Owner: Tim Graham
Graham |
Type: | Status: assigned
Cleanup/optimization |
Component: Database | Version: dev
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
In Django 3.2, the `DEFAULT_AUTO_FIELD` setting and
`AppConfig.default_auto_field` attribute were added to start nudging users
from `AutoField` to `BigAutoField`.

The default `startproject` template has `DEFAULT_AUTO_FIELD =
'django.db.models.BigAutoField'` and the default startapp template has
`default_auto_field = ‘django.db.models.BigAutoField'` but
`django.conf.global_settings` has `DEFAULT_AUTO_FIELD =
"django.db.models.AutoField"`.

Phase two of the plan is changing the `DEFAULT_AUTO_FIELD` in
`django.conf.global_settings` to `BigAutoField`. Since there has has
effectively been a quasi-deprecation warning generated by the system check
framework since Django 3.2 if neither `DEFAULT_AUTO_FIELD` nor
`AppConfig.default_auto_field` are set, I think no deprecation period is
needed and we can make these changes in Django 6.0:

* Change `django.conf.global_settings.DEFAULT_AUTO_FIELD` from `AutoField`
to `BigAutoField`.
* Remove `DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'` from the
default project template.
* Remove `default_auto_field = 'django.db.models.BigAutoField'` from the
default app template.
* Remove the system check that’s acted as a deprecation warning (example
output below):

{{{
WARNINGS:
app_label.Model: (models.W042) Auto-created primary key used when not
defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the
AppConfig.default_auto_field attribute to point to a subclass of
AutoField, e.g. 'django.db.models.BigAutoField'.
}}}

When [https://forum.djangoproject.com/t/changing-default-auto-field-to-
bigautofield/42452 raised on the forum], the only concern is whether the
fellows will have time to review the patch.
--
Ticket URL: <https://code.djangoproject.com/ticket/36564>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Aug 20, 2025, 6:31:10 PMAug 20
to django-...@googlegroups.com
#36564: Change DEFAULT_AUTO_FIELD to BigAutoField
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | Graham
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* has_patch: 0 => 1

Comment:

[https://github.com/django/django/pull/19753 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/36564#comment:1>

Django

unread,
Aug 21, 2025, 8:13:16 AMAug 21
to django-...@googlegroups.com
#36564: Change DEFAULT_AUTO_FIELD to BigAutoField
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | Graham
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):

* stage: Unreviewed => Accepted

Comment:

Thank you Tim for the ticket and for starting the forum post, that's a
great head start. Accepting based on the forum conversation, but as I
mentioned there, we'll do our best to land this in 6.0; otherwise it will
be an early 6.1 change.
--
Ticket URL: <https://code.djangoproject.com/ticket/36564#comment:2>

Django

unread,
Aug 22, 2025, 4:30:39 PM (14 days ago) Aug 22
to django-...@googlegroups.com
#36564: Change DEFAULT_AUTO_FIELD to BigAutoField
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | Graham
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Alex):

* cc: Alex (added)

--
Ticket URL: <https://code.djangoproject.com/ticket/36564#comment:3>

Django

unread,
Sep 4, 2025, 11:05:07 AM (20 hours ago) Sep 4
to django-...@googlegroups.com
#36564: Change DEFAULT_AUTO_FIELD to BigAutoField
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | Graham
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 0 => 1

--
Ticket URL: <https://code.djangoproject.com/ticket/36564#comment:4>

Django

unread,
Sep 4, 2025, 3:20:07 PM (16 hours ago) Sep 4
to django-...@googlegroups.com
#36564: Change DEFAULT_AUTO_FIELD to BigAutoField
-------------------------------------+-------------------------------------
Reporter: Tim Graham | Owner: Tim
Type: | Graham
Cleanup/optimization | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Jacob Walls):

* needs_better_patch: 1 => 0
* stage: Accepted => Ready for checkin

--
Ticket URL: <https://code.djangoproject.com/ticket/36564#comment:5>
Reply all
Reply to author
Forward
0 new messages