mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 13:30:12 +03:00
required not actually necessary if allow_null present
This commit is contained in:
parent
0d85b5575e
commit
3b07c1dfc6
|
@ -3,7 +3,7 @@ from rest_framework import serializers
|
|||
|
||||
class LinkSerializer(serializers.Serializer):
|
||||
name = serializers.CharField(max_length=25)
|
||||
next = serializers.RecursiveField(required=False, allow_null=True)
|
||||
next = serializers.RecursiveField(allow_null=True)
|
||||
|
||||
|
||||
class NodeSerializer(serializers.Serializer):
|
||||
|
@ -104,6 +104,7 @@ class TestRecursiveField:
|
|||
'name': 'something',
|
||||
'next': {
|
||||
'name': 'inner something',
|
||||
'next': None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,6 +117,7 @@ class TestRecursiveField:
|
|||
'nullable': 'not null',
|
||||
'links': {
|
||||
'name': 'something',
|
||||
'next': None,
|
||||
}
|
||||
}
|
||||
serializer = SillySerializer(data=max_length)
|
||||
|
@ -128,6 +130,7 @@ class TestRecursiveField:
|
|||
'nullable': 'not null',
|
||||
'links': {
|
||||
'name': 'something',
|
||||
'next': None,
|
||||
}
|
||||
}
|
||||
serializer = SillySerializer(data=nulled_out)
|
||||
|
@ -142,6 +145,7 @@ class TestRecursiveField:
|
|||
'name': 'something',
|
||||
'next': {
|
||||
'name': 'inner something that is much too long',
|
||||
'next': None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user