Skip to content

Fixes instance check in ListSerializer.to_representation (#8726) #8727

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 13 commits into from
Nov 22, 2022
Merged
2 changes: 1 addition & 1 deletion rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ def to_representation(self, data):
"""
# Dealing with nested relationships, data can be a Manager,
# so, first get a queryset from the Manager if needed
iterable = data.all() if isinstance(data, models.Manager) else data
iterable = data.all() if isinstance(data, models.manager.BaseManager) else data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I triggered the CI, can you please pull from main branch again? the bug was not verify able in the test suite, would you mind investigate further to figure out if we can add some relevant test for this?

Copy link
Contributor Author

@954-Ivory 954-Ivory Nov 21, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I triggered the CI, can you please pull from main branch again? the bug was not verify able in the test suite, would you mind investigate further to figure out if we can add some relevant test for this?

Yes, but it may take a while.
I'm a little hungry. I'm going to cook dinner first. 😋


Is that what you mean? ( My English is not good )

  1. Append the test case.
  2. Merge this branch to master in my fork ( I'm not sure about this ).
  3. Then pull request again (encode:master from 954-ivory:master).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant pull from encode:master to your working branch for this PR 954-ivory:master so that the recently updated versions in CI could reflect here. And some unit tests :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the rebase, now just appending/adding additional test cases would be really great


return [
self.child.to_representation(item) for item in iterable
Expand Down