Opened 5 months ago
Last modified 5 months ago
#35786 assigned Bug
AddField reference to Django's support for database defaults is outdated
Reported by: | Václav Řehák | Owned by: | Virender121 |
---|---|---|---|
Component: | Documentation | Version: | 5.1 |
Severity: | Normal | Keywords: | db_default |
Cc: | Triage Stage: | Accepted | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Pull Requests: | How to create a pull request | ||
Description ¶
The docs of AddField
at https://docs.djangoproject.com/en/dev/ref/migration-operations/#addfield says
It does not affect the behavior of setting defaults in the database directly - Django never sets database defaults and always applies them in the Django ORM code.
I think this wording is confusing because since adding db_default
Django ORM actually does set db defaults. The same sentence is present in AlterField
docs.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.
Change History (3)
comment:1 by , 5 months ago
comment:2 by , 5 months ago
Keywords: | db_default added |
---|---|
Summary: | Incorrect info about database defaults in migrations doc → AddField reference to Django's support for database defaults is outdated |
Triage Stage: | Unreviewed → Accepted |
Nice catch!
comment:3 by , 5 months ago
Owner: | set to |
---|---|
Status: | new → assigned |
Btw, there was already a comment about this 8 years ago, see https://code.djangoproject.com/ticket/26476#comment:3
"arguably, the documentation is not clear enough; what is meant is that Django never leaves defaults in the database."