Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Conversation

@Lynskylate
Copy link
Contributor

Fixes #10
implement Queryset-level delete
I want to reuse build_select_expression, but it seems to no way to change the expression's select column.
The return value of delete method is worth discussing.
Please review

@rafalp
Copy link
Contributor

rafalp commented Aug 11, 2019

Does this change make it possible to explicitly delete all rows in the table? Django provides .all().delete() for this case and while it's rare, it is useful in some situations.

@Lynskylate
Copy link
Contributor Author

Does this change make it possible to explicitly delete all rows in the table? Django provides .all().delete() for this case and while it's rare, it is useful in some situations.

Sorry, we can't. We need to refactor the QuerySet's method all to implement it.

await User.objects.delete(name="Jany")
assert await User.objects.count() == 1

await Product.objects.create(name="T-Shirt", rating=5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add await Product.objects.create(name="Dress", rating=4) to ensure both filter clauses are respected by build_delete_expression

@aminalaee
Copy link
Contributor

aminalaee commented Sep 20, 2021

This is way too old, and if I'm not mistaken, think #111 is simpler, so I'll close this for now.

@aminalaee aminalaee closed this Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Queryset-level deletes

4 participants