diff options
| author | Yash <yashraj504300@gmail.com> | 2024-10-16 14:38:31 +0530 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-10-23 11:51:13 +0200 |
| commit | 630c9e1f9d05e9d25908a0c5d5f81f1b0b537af0 (patch) | |
| tree | 99b8f32ab7d2f7dcef4ad7d308df9c39ec83800a /docs/ref | |
| parent | d9f37ac118e1717f831394d2be3b64c712d3b40e (diff) | |
[5.1.x] Fixed #35731 -- Extended db_default docs.
This added a missing db_default reference in docs/topics/db/models.txt,
and added a reference to the DatabaseDefault object.
Backport of 35ab2e018214479fa712d73f070198299ef670a1 from main.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/models/fields.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 0ceb620a9f..745520961d 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -434,6 +434,11 @@ precedence when creating instances in Python code. ``db_default`` will still be set at the database level and will be used when inserting rows outside of the ORM or when adding a new field in a migration. +If a field has a ``db_default`` without a ``default`` set and no value is +assigned to the field, a ``DatabaseDefault`` object is returned as the field +value on unsaved model instances. The actual value for the field is determined +by the database when the model instance is saved. + ``db_index`` ------------ |
