diff options
| author | kimsoungryoul <kimsoungryoul@gmail.com> | 2022-10-16 14:59:39 +0900 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-12-28 06:28:07 +0100 |
| commit | 78f163a4fb3937aca2e71786fbdd51a0ef39629e (patch) | |
| tree | 7e61c2f8d96b9dab60e317d3483460064327d701 /docs/ref/models | |
| parent | 68ef274bc505cd44f305c03cbf84cf08826200a8 (diff) | |
Fixed #18468 -- Added support for comments on columns and tables.
Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz
Felisiak for reviews.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
Diffstat (limited to 'docs/ref/models')
| -rw-r--r-- | docs/ref/models/fields.txt | 15 | ||||
| -rw-r--r-- | docs/ref/models/options.txt | 18 |
2 files changed, 33 insertions, 0 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt index 0afddc14a8..d460e81ef4 100644 --- a/docs/ref/models/fields.txt +++ b/docs/ref/models/fields.txt @@ -325,6 +325,21 @@ characters that aren't allowed in Python variable names -- notably, the hyphen -- that's OK. Django quotes column and table names behind the scenes. +``db_comment`` +-------------- + +.. versionadded:: 4.2 + +.. attribute:: Field.db_comment + +The comment on the database column to use for this field. It is useful for +documenting fields for individuals with direct database access who may not be +looking at your Django code. For example:: + + pub_date = models.DateTimeField( + db_comment="Date and time when the article was published", + ) + ``db_index`` ------------ diff --git a/docs/ref/models/options.txt b/docs/ref/models/options.txt index a1629168af..a882fcb05a 100644 --- a/docs/ref/models/options.txt +++ b/docs/ref/models/options.txt @@ -91,6 +91,24 @@ Django quotes column and table names behind the scenes. backends; except for Oracle, however, the quotes have no effect. See the :ref:`Oracle notes <oracle-notes>` for more details. +``db_table_comment`` +-------------------- + +.. versionadded:: 4.2 + +.. attribute:: Options.db_table_comment + +The comment on the database table to use for this model. It is useful for +documenting database tables for individuals with direct database access who may +not be looking at your Django code. For example:: + + class Answer(models.Model): + question = models.ForeignKey(Question, on_delete=models.CASCADE) + answer = models.TextField() + + class Meta: + db_table_comment = "Question answers" + ``db_tablespace`` ----------------- |
