Skip to content

Allow traversing nullable related fields #5849

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

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

gcbirzan
Copy link
Contributor

@gcbirzan gcbirzan commented Feb 23, 2018

This allows you to have a related field that traverses nullable relations. A default is required to have the value in the output, but the current behaviour is to throw an AttributeError.

Closes #5848

@carltongibson carltongibson added this to the 3.8 Release milestone Mar 20, 2018
@carltongibson carltongibson self-assigned this Mar 20, 2018
@carltongibson
Copy link
Collaborator

carltongibson commented Mar 20, 2018

Hi @gcbirzan. This looks very much in line with the other changes we've made thus far here, following from #5375.

I just want to look at the test case a little more closely. Specifically, how it differs from the test case in #5880 and whether we can combine the two.

@carltongibson
Copy link
Collaborator

carltongibson commented Mar 20, 2018

Hi @gcbirzan.

The difference in the tests was just exactly that you're one was using RelatedField whereas the previous one had used an CharField.

I adjusted the test to use the existing models. This looks good to me. Thanks for the input!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants