Commit c3c9a712 by Venelin Stoykov

Fix ManyRelatedField.choices

Use choices from self.child_relation. 
We don't need to repeat ourself because can get out of sync.
parent 36e4f201
......@@ -388,16 +388,4 @@ class ManyRelatedField(Field):
@property
def choices(self):
queryset = self.child_relation.queryset
iterable = queryset.all() if (hasattr(queryset, 'all')) else queryset
items_and_representations = [
(item, self.child_relation.to_representation(item))
for item in iterable
]
return OrderedDict([
(
six.text_type(item_representation),
six.text_type(item) + ' - ' + six.text_type(item_representation)
)
for item, item_representation in items_and_representations
])
return self.child_relation.choices
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment