Ticket #3455: 3455.diff
File 3455.diff, 792 bytes (added by , 18 years ago) |
---|
-
docs/model-api.txt
498 498 class Foo(models.Model): 499 499 gender = models.CharField(maxlength=1, choices=GENDER_CHOICES) 500 500 501 For each field on your model which has ``choices`` set, Django will 502 add a method to retrieve the human-readable name for the field's 503 current value; see `get_FOO_display`_ in the database API 504 documentation. 505 506 .. _get_FOO_display: ../db_api/#get-foo-display 507 501 508 Finally, note that choices can be any iterable object -- not necessarily a 502 509 list or tuple. This lets you construct choices dynamically. But if you find 503 510 yourself hacking ``choices`` to be dynamic, you're probably better off using