Merge pull request #493 from edavis/fix-get-foo-display-docs
Fixed formatting of get_FOO_display example
This commit is contained in:
commit
3e9b36688d
|
@ -616,25 +616,25 @@ the field. This method returns the "human-readable" value of the field.
|
||||||
|
|
||||||
For example::
|
For example::
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
class Person(models.Model):
|
class Person(models.Model):
|
||||||
SHIRT_SIZES = (
|
SHIRT_SIZES = (
|
||||||
(u'S', u'Small'),
|
(u'S', u'Small'),
|
||||||
(u'M', u'Medium'),
|
(u'M', u'Medium'),
|
||||||
(u'L', u'Large'),
|
(u'L', u'Large'),
|
||||||
)
|
)
|
||||||
name = models.CharField(max_length=60)
|
name = models.CharField(max_length=60)
|
||||||
shirt_size = models.CharField(max_length=2, choices=SHIRT_SIZES)
|
shirt_size = models.CharField(max_length=2, choices=SHIRT_SIZES)
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
>>> p = Person(name="Fred Flintstone", shirt_size="L")
|
>>> p = Person(name="Fred Flintstone", shirt_size="L")
|
||||||
>>> p.save()
|
>>> p.save()
|
||||||
>>> p.shirt_size
|
>>> p.shirt_size
|
||||||
u'L'
|
u'L'
|
||||||
>>> p.get_shirt_size_display()
|
>>> p.get_shirt_size_display()
|
||||||
u'Large'
|
u'Large'
|
||||||
|
|
||||||
.. method:: Model.get_next_by_FOO(\**kwargs)
|
.. method:: Model.get_next_by_FOO(\**kwargs)
|
||||||
.. method:: Model.get_previous_by_FOO(\**kwargs)
|
.. method:: Model.get_previous_by_FOO(\**kwargs)
|
||||||
|
|
Loading…
Reference in New Issue