mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
Fixed many=False issue in related fields
Added check to pop many from kwargs before passing to __init__ Fixed my lint issue from the previous commit
This commit is contained in:
parent
79736e516a
commit
d24990ece2
|
@ -42,6 +42,8 @@ class RelatedField(Field):
|
|||
'Relational fields should not provide a `queryset` argument, '
|
||||
'when setting read_only=`True`.'
|
||||
)
|
||||
if 'many' in kwargs:
|
||||
kwargs.pop('many')
|
||||
super(RelatedField, self).__init__(**kwargs)
|
||||
|
||||
def __new__(cls, *args, **kwargs):
|
||||
|
|
|
@ -52,7 +52,7 @@ class TestPrimaryKeyRelatedField(APISimpleTestCase):
|
|||
field = serializers.PrimaryKeyRelatedField(queryset=self.queryset, many=False)
|
||||
instance = field.to_internal_value(self.instance.pk)
|
||||
assert instance is self.instance
|
||||
|
||||
|
||||
|
||||
class TestProxiedPrimaryKeyRelatedField(APISimpleTestCase):
|
||||
def setUp(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user