mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-11 04:07:39 +03:00
Remove Field handling relations/relationship managers - use RelatedField/ManyRelatedField instead
This commit is contained in:
parent
5c17a60176
commit
dc52ceaaa2
|
@ -83,10 +83,6 @@ class Field(object):
|
|||
|
||||
if is_protected_type(value):
|
||||
return value
|
||||
|
||||
all_callable = getattr(value, 'all', None)
|
||||
if is_simple_callable(all_callable):
|
||||
return [self.to_native(item) for item in value.all()]
|
||||
elif hasattr(value, '__iter__') and not isinstance(value, (dict, basestring)):
|
||||
return [self.to_native(item) for item in value]
|
||||
return smart_unicode(value)
|
||||
|
|
|
@ -19,7 +19,7 @@ class TestGenericRelations(TestCase):
|
|||
|
||||
def test_reverse_generic_relation(self):
|
||||
class BookmarkSerializer(serializers.ModelSerializer):
|
||||
tags = serializers.Field(source='tags')
|
||||
tags = serializers.ManyRelatedField(source='tags')
|
||||
|
||||
class Meta:
|
||||
model = Bookmark
|
||||
|
|
Loading…
Reference in New Issue
Block a user