Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to None when using the Serializer as Form for Browsable… #6266

Merged
merged 1 commit into from
Oct 9, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions readthedocs/api/v3/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,11 @@ class Meta:

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

super().__init__(*args, **kwargs)

def validate_child(self, value):
Expand Down