EMP_CHOICES = (
(0,'-- Select --'),
(1,'Good'),
(2,'Average'),
)
class EMPFeedback(models.Model):
user_choices = models.IntegerField(choices=EMP_CHOICES)
如果db中存储的值为1,则user_choices如何打印相应的user_choices对应值(即1 == GOOD)
fb = EMPFeedback.objects.get(id=1)
print fb.user_choices # prints 1
print fb.user_choices.EMP_CHOICES