Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
c3507552
Commit
c3507552
authored
Jul 02, 2015
by
Tom Christie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3104 from Seraf/master
Adding recursion on child of List Field
parents
8d69c4c0
2b979d43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
0 deletions
+24
-0
rest_framework/metadata.py
+3
-0
tests/test_metadata.py
+21
-0
No files found.
rest_framework/metadata.py
View file @
c3507552
...
...
@@ -131,6 +131,9 @@ class SimpleMetadata(BaseMetadata):
if
value
is
not
None
and
value
!=
''
:
field_info
[
attr
]
=
force_text
(
value
,
strings_only
=
True
)
if
getattr
(
field
,
'child'
,
None
):
field_info
[
'child'
]
=
self
.
get_field_info
(
field
.
child
)
if
not
field_info
.
get
(
'read_only'
)
and
hasattr
(
field
,
'choices'
):
field_info
[
'choices'
]
=
[
{
...
...
tests/test_metadata.py
View file @
c3507552
...
...
@@ -67,6 +67,11 @@ class TestMetadata:
char_field
=
serializers
.
CharField
(
required
=
False
,
min_length
=
3
,
max_length
=
40
)
list_field
=
serializers
.
ListField
(
child
=
serializers
.
ListField
(
child
=
serializers
.
IntegerField
()
)
)
class
ExampleView
(
views
.
APIView
):
"""Example view."""
...
...
@@ -119,6 +124,22 @@ class TestMetadata:
'label'
:
'Char field'
,
'min_length'
:
3
,
'max_length'
:
40
},
'list_field'
:
{
'type'
:
'list'
,
'required'
:
True
,
'read_only'
:
False
,
'label'
:
'List field'
,
'child'
:
{
'type'
:
'list'
,
'required'
:
True
,
'read_only'
:
False
,
'child'
:
{
'type'
:
'integer'
,
'required'
:
True
,
'read_only'
:
False
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment