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

Changed "Don't overuse count() or exists()" example to Python #13294

Merged
merged 1 commit into from
Jan 27, 2021

Conversation

adamchainz
Copy link
Sponsor Member

Many Django developers don't use templates these days, instead working on API's. The ORM is the common denominator, and I think the plain Python makse the example a littl clearer.

@arthtyagi
Copy link

This does seem nice but instead of removing the existing snippet, how about just adding this one along with that?

@adamchainz
Copy link
Sponsor Member Author

I think keeping both versions is just bloat. Anyone who understands the Python version and how templates work should be able to understand how the problem can appear in templates too.

Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

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

@adamchainz Thanks 👍

docs/topics/db/optimization.txt Outdated Show resolved Hide resolved
docs/topics/db/optimization.txt Outdated Show resolved Hide resolved
@felixxm felixxm force-pushed the improve_overuse_documentation branch from c338fe1 to 8a642b8 Compare January 27, 2021 19:25
Copy link
Member

@felixxm felixxm left a comment

Choose a reason for hiding this comment

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

@adamchainz Thanks 👍 I pushed minor edits.

@@ -261,46 +261,38 @@ Don't overuse ``count()`` and ``exists()``
If you are going to need other data from the QuerySet, evaluate it immediately.

For example, assuming an Email model that has a ``body`` attribute and a
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
For example, assuming an Email model that has a ``body`` attribute and a
For example, assuming an Email model that has a ``subject`` attribute and a

@felixxm felixxm merged commit 8a642b8 into django:master Jan 27, 2021
@adamchainz adamchainz deleted the improve_overuse_documentation branch March 13, 2023 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants