I'd also recommend using the "Choices" functionality of the Django Model Utils project. It will give you good tools to keep the code readable, simplify access and presentation of data:
https://django-model-utils.readthedocs.org/en/latest/utilities.html#choices On Mon, Mar 23, 2015 at 4:34 PM, Vijay Khemlani <vkhem...@gmail.com> wrote: > You can use an IntegerField with choices > > https://docs.djangoproject.com/en/1.7/ref/models/fields/#choices > > On Mon, Mar 23, 2015 at 4:28 PM, Daniel Grace <danwgr...@gmail.com> wrote: > >> How to create a field with multiple values? For example an integer field >> that takes on particular values: >> >> state = models.IntegerField() >> >> ... where state=0 represents 'pending', state=1 represents 'accepted' and >> state=2 represents 'rejected'. >> Is it possible to put these values / constants into the model? >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Django users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to django-users+unsubscr...@googlegroups.com. >> To post to this group, send email to django-users@googlegroups.com. >> Visit this group at http://groups.google.com/group/django-users. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/django-users/0ffb0a31-d900-4b62-826b-b779bab472a2%40googlegroups.com >> <https://groups.google.com/d/msgid/django-users/0ffb0a31-d900-4b62-826b-b779bab472a2%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/CALn3ei1X%2Bam5Mdwq6Upz_CCnEaea8XaZkKbEnpHL3MC25CrmJQ%40mail.gmail.com > <https://groups.google.com/d/msgid/django-users/CALn3ei1X%2Bam5Mdwq6Upz_CCnEaea8XaZkKbEnpHL3MC25CrmJQ%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Filipe Ximenes*+55 (81) 8245-9204 *Vinta Software Studio*http://www.vinta.com.br -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAA-QWB3qK3Vex8%2Bzf2xFX%2BzRb9CMjfuoWaAU8uYMNk6umo4NxA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.