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

Check if manager is None instead of Falsy #66

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

wkleinheerenbrink
Copy link

A custom defined manager will be overridden by the _default_manager when the custom manager returns QuerySet<[]>, because bool(QuerySet<[]>) is False

I haven't had time to write the unit test and test on all versions, but I would like to provide you with the fix already.

A custom defined manager will be overridden by the `_default_manager` when the custom manager returns `QuerySet<[]>`, because `bool(QuerySet<[]>) is False`
@justinmayer
Copy link
Owner

Many thanks for the contribution, Wouter. Do you think you could include a test for this so we can ensure proper functionality in the future?

@msopacua
Copy link

@wkleinheerenbrink I don't know what the test should be. I tried to write one, but the behaviour doesn't change for fields that have a unique attribute. What scenario did you have that made it matter which manager is used if the queryset is empty?

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.

3 participants