class Coupon(models.Model):
offer_types = (
(1, 'Percentage Off'),
(2, 'Amount Off'),
(3, 'Free'),
)
business = models.ForeignKey(Business)
offer_type = models.IntegerField(choices=offer_types)
How do I then retrieve the "human readable" values when referencing a
Coupon object? Right now Coupon.objects.get(id=1).offer_type returns
the numeric value only ("3" instead of "free"... which I suppose is to
be expected).
Thanks!
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
No comments:
Post a Comment