mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-05 13:00:12 +03:00
Add field's initial value to metadata
This commit is contained in:
parent
3645388547
commit
613b5a61d3
|
@ -124,7 +124,8 @@ class SimpleMetadata(BaseMetadata):
|
||||||
attrs = [
|
attrs = [
|
||||||
'read_only', 'label', 'help_text',
|
'read_only', 'label', 'help_text',
|
||||||
'min_length', 'max_length',
|
'min_length', 'max_length',
|
||||||
'min_value', 'max_value'
|
'min_value', 'max_value',
|
||||||
|
'initial',
|
||||||
]
|
]
|
||||||
|
|
||||||
for attr in attrs:
|
for attr in attrs:
|
||||||
|
|
|
@ -135,10 +135,12 @@ class TestMetadata:
|
||||||
'required': True,
|
'required': True,
|
||||||
'read_only': False,
|
'read_only': False,
|
||||||
'label': 'List field',
|
'label': 'List field',
|
||||||
|
'initial': '[]',
|
||||||
'child': {
|
'child': {
|
||||||
'type': 'list',
|
'type': 'list',
|
||||||
'required': True,
|
'required': True,
|
||||||
'read_only': False,
|
'read_only': False,
|
||||||
|
'initial': '[]',
|
||||||
'child': {
|
'child': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
'required': True,
|
'required': True,
|
||||||
|
@ -322,7 +324,8 @@ class TestModelSerializerMetadata(TestCase):
|
||||||
'type': 'field',
|
'type': 'field',
|
||||||
'required': False,
|
'required': False,
|
||||||
'read_only': True,
|
'read_only': True,
|
||||||
'label': 'Children'
|
'label': 'Children',
|
||||||
|
'initial': '[]',
|
||||||
},
|
},
|
||||||
'integer_field': {
|
'integer_field': {
|
||||||
'type': 'integer',
|
'type': 'integer',
|
||||||
|
|
Loading…
Reference in New Issue
Block a user