toastdriven/django-tastypie — pull request #502 by matthewbelisle-wf (2012-05-21 18:51:47+00:00)
Title: Added get_FOO_display to bundle for CharFields with choices

For a model field where choices are specified like this:

class Person(models.Model):
name = models.CharField(max_length=64)
GENDER_CHOICES = (('M', 'Male'),
('F', 'Female'))
gender = models.CharField(max_length=1, choices=GENDER_CHOICES)

the user probably wants to see the Person.get_gender_display() value instead of just the Person.gender value, which would be just 'M' or 'F'. I added a check to ModelResource.full_dehydrate() to add this extra field if appropriate. I checked and all tests pass still