diff options
| author | Tom Christie | 2013-12-09 07:45:45 +0000 |
|---|---|---|
| committer | Tom Christie | 2013-12-09 07:45:45 +0000 |
| commit | 80ef2685e522fc87bd8af9767aa7b231c9991ea4 (patch) | |
| tree | 4be3191af2eec42ffea97443c9e9f11ee5631ca7 /rest_framework/fields.py | |
| parent | 4e9385e709bcee87456a99839841ecf6b56f337a (diff) | |
| parent | 175b4d233d578b5964db72f91a96bb3b4a0f3e99 (diff) | |
| download | django-rest-framework-80ef2685e522fc87bd8af9767aa7b231c9991ea4.tar.bz2 | |
Merge master
Diffstat (limited to 'rest_framework/fields.py')
| -rw-r--r-- | rest_framework/fields.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 463d296f..5a4f04a5 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -514,6 +514,11 @@ class ChoiceField(WritableField): choices = property(_get_choices, _set_choices) + def metadata(self): + data = super(ChoiceField, self).metadata() + data['choices'] = [{'value': v, 'display_name': n} for v, n in self.choices] + return data + def validate(self, value): """ Validates that the input is in self.choices. |
