summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorYash <yashraj504300@gmail.com>2024-10-16 14:38:31 +0530
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-10-23 11:48:30 +0200
commit35ab2e018214479fa712d73f070198299ef670a1 (patch)
treefbcfd28d37801f1d7c6d712e50c5e90c6936a5a2 /docs/topics
parent04adff9f98a93a546d7b4d7453b80965233d22a3 (diff)
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.
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/db/models.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
index e7bc1681fb..f7f575eb3f 100644
--- a/docs/topics/db/models.txt
+++ b/docs/topics/db/models.txt
@@ -224,6 +224,15 @@ ones:
object. If callable it will be called every time a new object is
created.
+:attr:`~Field.db_default`
+ The database-computed default value for the field. This can be a literal
+ value or a database function.
+
+ If both ``db_default`` and :attr:`Field.default` are set, ``default`` will
+ take 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.
+
:attr:`~Field.help_text`
Extra "help" text to be displayed with the form widget. It's useful for
documentation even if your field isn't used on a form.