diff options
| author | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-02-26 21:40:15 +0000 |
|---|---|---|
| committer | Jacob Kaplan-Moss <jacob@jacobian.org> | 2007-02-26 21:40:15 +0000 |
| commit | 96604fdf8f34a9e51d1f61a8c81ba5ef843b5ee9 (patch) | |
| tree | a48259e8d583baab9f3347bf8af2d7d8cf0c2dc3 /docs | |
| parent | 9f1bf4659bf4b109c71afae7980d6341a2426500 (diff) | |
Fixed #3455: added documentation of Model.get_FIELD_display(). Thanks, Ubernostrum.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@4625 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/model-api.txt | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/docs/model-api.txt b/docs/model-api.txt index 9f87d53719..51f4b72c22 100644 --- a/docs/model-api.txt +++ b/docs/model-api.txt @@ -498,6 +498,13 @@ or outside your model class altogether:: class Foo(models.Model): gender = models.CharField(maxlength=1, choices=GENDER_CHOICES) +For each field on your model which 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 |
