aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/fields.py
diff options
context:
space:
mode:
authorIan Foote2013-11-26 09:33:47 +0000
committerIan Foote2013-11-26 09:33:47 +0000
commita38d9d5b24501ae0e279c9afbea08e423112ba34 (patch)
tree6bf5d29706c1b991e8ce5ddd472fd24c46af8dae /rest_framework/fields.py
parent43c4e3aab8b689bc846e52ef9bc512d1639205b6 (diff)
downloaddjango-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.py5
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.