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:
Brian Grohe 2015-06-17 13:43:35 -04:00
parent 79736e516a
commit d24990ece2
2 changed files with 3 additions and 1 deletions

View File

@ -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):

View File

@ -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):