Skip to content

Commit af4ef4f

Browse files
authored
Merge pull request #6266 from readthedocs/humitos/browsable-api-subprojects-list
Default to None when using the Serializer as Form for BrowsableAPI
2 parents 8fd1fe3 + 3994415 commit af4ef4f

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

readthedocs/api/v3/serializers.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,11 @@ class Meta:
557557

558558
def __init__(self, *args, **kwargs):
559559
# Initialize the instance with the parent Project to be used in the
560-
# serializer validation.
561-
self.parent_project = kwargs.pop('parent')
560+
# serializer validation. When this Serializer is rendered as a Form in
561+
# BrowsableAPIRenderer, it's not initialized with the ``parent``, so we
562+
# default to ``None`` because we don't need it at that point.
563+
self.parent_project = kwargs.pop('parent', None)
564+
562565
super().__init__(*args, **kwargs)
563566

564567
def validate_child(self, value):

0 commit comments

Comments
 (0)