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
Fixed #29865 -- Added logical XOR support for Q() and QuerySet(). #14480
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's a very quick pass. I've not looked at the tests yet.
77c86b6
to
271e0cf
Compare
058a90f
to
0fd449f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates.
Please update some of the existing tests.
Add the following to the end of tests
in QTests.test_combine_empty_copy
:
base_q ^ Q(),
Q() ^ base_q,
Add the following to the end of QTests.test_combine_not_q_object
:
with self.assertRaisesMessage(TypeError, str(obj)):
q ^ obj
Add the following to the end of tests
in QTests.test_combine_negated_boolean_expression
:
Q() ^ ~Exists(tagged),
It seems as though we'd want to add to QuerySetBitwiseOperationTests
too to test the QuerySet
behavior?
Also, I don't think that we need to create tests/xor_lookups
. These tests should fit in around QuerySet
-related tests for &
and |
.
I've marked this as patch needs improvement on ticket-29865. Please remove that flag when you're ready for another round of review. Thanks.
bf29100
to
5e11b75
Compare
I had some issues around rebasing and force pushing, a nightmare, I think it has been resolved. I've added those tests in and I added tests to The |
My mistake. That'll teach me for making this point based on the non-existent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've suggested a few more tweaks in the documentation.
Please can you change the commit message and PR title to the following:
Fixed #29865 -- Added logical XOR support for Q() and QuerySet().
I've also noticed that the ticket was triaged and "Someday/Maybe" and not "Accepted". I'm sorry I didn't notice this before. However, based on the fact that we have what seems to be a working implementation here I'll change it to "Accepted". This will put it on the review queue for the fellows to follow up on.
buildbot, test on oracle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rheard Thanks for this patch 👍
4659059
to
dadea92
Compare
@rheard Thanks for updates 👍 |
317e173
to
dcd3ed0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rheard I pushed small edits to tests and docs. Unfortunately, I found an issue in chaining multiple conditions. Can you take a look?
Also, please don't rebase this patch and push edits in separate commits. I will squash everything before merging.
d9fac68
to
05942a5
Compare
I changed to |
Sorry, quickly realized that. Again, will implement my proposed solution when I have time. Thanks! |
I rebased from the |
0380451
to
00f10e6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rheard Thanks for all your efforts 👍 Welcome aboard ⛵
I pushed final edits and squashed commits.
Add logical XOR support to the ORM. MySQL will use the logical XOR, while other backends will convert