diff options
| author | Ian Foote | 2013-11-26 09:33:47 +0000 | 
|---|---|---|
| committer | Ian Foote | 2013-11-26 09:33:47 +0000 | 
| commit | a38d9d5b24501ae0e279c9afbea08e423112ba34 (patch) | |
| tree | 6bf5d29706c1b991e8ce5ddd472fd24c46af8dae /rest_framework/fields.py | |
| parent | 43c4e3aab8b689bc846e52ef9bc512d1639205b6 (diff) | |
| download | django-rest-framework-a38d9d5b24501ae0e279c9afbea08e423112ba34.tar.bz2 | |
Add choices to options metadata for ChoiceField.
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 6c07dbb3..80eff66c 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'] = self.choices +        return data +      def validate(self, value):          """          Validates that the input is in self.choices. | 
