Moved documentation for Choices field to the right place

This commit is contained in:
Tony Aldridge 2013-08-24 10:40:53 +01:00
parent 3485df15f2
commit cac7416cda

View file

@ -55,6 +55,20 @@ the third is the human-readable version:
# ...
status = models.IntegerField(choices=STATUS, default=STATUS.draft)
Choices can be concatenated with the ``+`` operator, both to other Choices
instances and other iterable objects that could be converted into Choices:
.. code-block:: python
from model_utils import Choices
GENERIC_CHOICES = Choices((0, 'draft', _('draft')), (1, 'published', _('published')))
class Article(models.Model):
STATUS = GENERIC_CHOICES + [(2, 'featured', _('featured'))]
# ...
status = models.IntegerField(choices=STATUS, default=STATUS.draft)
Field Tracker
=============