summaryrefslogtreecommitdiff
path: root/docs/model-api.txt
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-02-27 00:01:43 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-02-27 00:01:43 +0000
commit5e34ce97df3563883f1c0035e2150f90fe78ed30 (patch)
tree031ae632d44f6b7f72c4cd0200defde2b7d4cee7 /docs/model-api.txt
parent6df023007781e96fa1cfa8dfce0040cc9d7da871 (diff)
newforms-admin: Merged to [4629]
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4630 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/model-api.txt')
-rw-r--r--docs/model-api.txt6
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 9f87d53719..1e7f69903d 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -498,6 +498,12 @@ or outside your model class altogether::
class Foo(models.Model):
gender = models.CharField(maxlength=1, choices=GENDER_CHOICES)
+For each model field that has ``choices`` set, Django will add a method to
+retrieve the human-readable name for the field's current value. See
+`get_FOO_display`_ in the database API documentation.
+
+.. _get_FOO_display: ../db_api/#get-foo-display
+
Finally, note that choices can be any iterable object -- not necessarily a
list or tuple. This lets you construct choices dynamically. But if you find
yourself hacking ``choices`` to be dynamic, you're probably better off using