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
f5a9904c
Commit
f5a9904c
authored
Aug 11, 2015
by
Jeffrey de Lange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolved issue with rendering of nested serializers form when value is None
parent
a3e64fbe
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
rest_framework/utils/serializer_helpers.py
+5
-3
No files found.
rest_framework/utils/serializer_helpers.py
View file @
f5a9904c
...
@@ -88,6 +88,11 @@ class NestedBoundField(BoundField):
...
@@ -88,6 +88,11 @@ class NestedBoundField(BoundField):
`BoundField` that is used for serializer fields.
`BoundField` that is used for serializer fields.
"""
"""
def
__init__
(
self
,
field
,
value
,
errors
,
prefix
=
''
):
if
value
is
None
:
value
=
{}
super
(
NestedBoundField
,
self
)
.
__init__
(
field
,
value
,
errors
,
prefix
)
def
__iter__
(
self
):
def
__iter__
(
self
):
for
field
in
self
.
fields
.
values
():
for
field
in
self
.
fields
.
values
():
yield
self
[
field
.
field_name
]
yield
self
[
field
.
field_name
]
...
@@ -101,9 +106,6 @@ class NestedBoundField(BoundField):
...
@@ -101,9 +106,6 @@ class NestedBoundField(BoundField):
return
BoundField
(
field
,
value
,
error
,
prefix
=
self
.
name
+
'.'
)
return
BoundField
(
field
,
value
,
error
,
prefix
=
self
.
name
+
'.'
)
def
as_form_field
(
self
):
def
as_form_field
(
self
):
if
self
.
value
is
None
:
return
''
values
=
{}
values
=
{}
for
key
,
value
in
self
.
value
.
items
():
for
key
,
value
in
self
.
value
.
items
():
if
isinstance
(
value
,
(
list
,
dict
)):
if
isinstance
(
value
,
(
list
,
dict
)):
...
...
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