Skip to content

Check if manager is None instead of Falsy - #66

Open
wkleinheerenbrink wants to merge 2 commits into
justinmayer:masterfrom
wkleinheerenbrink:patch-1
Open

wkleinheerenbrink wants to merge 2 commits into
justinmayer:masterfrom
wkleinheerenbrink:patch-1

Conversation

@wkleinheerenbrink

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

@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?

@justinmayer

Copy link
Copy Markdown
Owner

Hmm. I re-opened this with the intention of merging it, but it seems like the tests are now failing, and I don't have time at the moment to figure out why.

This branch has not been deployed

No deployments
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