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

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

Merged
merged 13 commits into from
Nov 22, 2022

Conversation

954-Ivory
Copy link
Contributor

@954-Ivory 954-Ivory commented Oct 24, 2022

Issue: #8726

@954-Ivory
Copy link
Contributor Author

Some developer will use custom Manager create from BaseManager.
We need to check whether data is a BaseManager instance.

@kevin-brown
Copy link
Member

Shouldn't this only need to check the BaseManager type, since Manager also derives from it?

@954-Ivory
Copy link
Contributor Author

954-Ivory commented Oct 25, 2022

Shouldn't this only need to check the BaseManager type, since Manager also derives from it?

Yes, I forgot this.

@auvipy auvipy self-requested a review November 21, 2022 13:54
@@ -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

@954-Ivory 954-Ivory requested a review from auvipy November 21, 2022 14:01
@auvipy auvipy added the Bug label Nov 21, 2022
@auvipy
Copy link
Member

auvipy commented Nov 22, 2022

there are some issues with pre commit, can you check and fix them? you might need to run flake8 locally

Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

to fix nose deprecation warning

tests/test_serializer_lists.py Outdated Show resolved Hide resolved
Copy link
Member

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

this part was creating precommit problems

tests/test_serializer_lists.py Show resolved Hide resolved
tests/test_serializer_lists.py Outdated Show resolved Hide resolved
tests/test_serializer_lists.py Outdated Show resolved Hide resolved
tests/test_serializer_lists.py Outdated Show resolved Hide resolved
@auvipy
Copy link
Member

auvipy commented Nov 22, 2022

all green now! now another round of review before merge

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

Successfully merging this pull request may close these issues.

3 participants