Monday, March 23, 2015

Re: How to create a multi valued field in the model?

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:


On Mon, Mar 23, 2015 at 4:34 PM, Vijay Khemlani <vkhemlan@gmail.com> wrote:

On Mon, Mar 23, 2015 at 4:28 PM, Daniel Grace <danwgrace@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+unsubscribe@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.
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+unsubscribe@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.

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+unsubscribe@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.

No comments:

Post a Comment