Ticket #3455: 3455.diff

File 3455.diff, 792 bytes (added by James Bennett, 17 years ago)

Patch pointing out get_FOO_display in "choices" docs

  • docs/model-api.txt

     
    498498    class Foo(models.Model):
    499499        gender = models.CharField(maxlength=1, choices=GENDER_CHOICES)
    500500
     501For each field on your model which has ``choices`` set, Django will
     502add a method to retrieve the human-readable name for the field's
     503current value; see `get_FOO_display`_ in the database API
     504documentation.
     505
     506.. _get_FOO_display: ../db_api/#get-foo-display
     507
    501508Finally, note that choices can be any iterable object -- not necessarily a
    502509list or tuple. This lets you construct choices dynamically. But if you find
    503510yourself hacking ``choices`` to be dynamic, you're probably better off using
Back to Top