summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2018-09-14 11:25:31 -0400
committerTim Graham <timograham@gmail.com>2018-09-14 11:38:39 -0400
commitd483a5f0dc1089ac5caabed0f9b320434d2df723 (patch)
tree2503ad247725f8889d2dcd434ee5043ba76e568e /docs
parenta4495f4b989dc919d80fcf9f38e31e247faa94fb (diff)
Fixed #29756 -- Doc'd that model field names can't end with an underscore.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/db/models.txt4
1 files changed, 3 insertions, 1 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
index e61b91c81c..248c7dc5b9 100644
--- a/docs/topics/db/models.txt
+++ b/docs/topics/db/models.txt
@@ -649,7 +649,7 @@ just refer to the other model class wherever needed. For example::
Field name restrictions
-----------------------
-Django places only two restrictions on model field names:
+Django places some restrictions on model field names:
1. A field name cannot be a Python reserved word, because that would result
in a Python syntax error. For example::
@@ -663,6 +663,8 @@ Django places only two restrictions on model field names:
class Example(models.Model):
foo__bar = models.IntegerField() # 'foo__bar' has two underscores!
+3. A field name cannot end with an underscore, for similar reasons.
+
These limitations can be worked around, though, because your field name doesn't
necessarily have to match your database column name. See the
:attr:`~Field.db_column` option.